diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e26df5bda31..a1e8b60164c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,4 +74,4 @@ jobs: CLOUDFLARE_ZONE_ID: 0da42c8d2132a9ddaf714f9e7c92011 CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }} run: | - rye run python ./examples/workers/ai/demo.py + rye run python ./examples/ai/demo.py diff --git a/.stats.yml b/.stats.yml index 9709f00a3ac..3b06a3c53b3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1460 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-6bb90de90ae3ffcac71bd91b9ad7338325a7ca45b28c334b686b427877b4d849.yml +configured_endpoints: 1494 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-817b1412335b2bc367169247bf8a10b29dbadb82b77df71df5ef5f3470fc974b.yml diff --git a/api.md b/api.md index 018bdbfda7a..23c7913ee2d 100644 --- a/api.md +++ b/api.md @@ -123,6 +123,20 @@ Methods: - client.accounts.tokens.value.update(token_id, \*, account_id, \*\*params) -> str +## Logs + +### Audit + +Types: + +```python +from cloudflare.types.accounts.logs import AuditListResponse +``` + +Methods: + +- client.accounts.logs.audit.list(\*, account_id, \*\*params) -> SyncCursorLimitPagination[AuditListResponse] + # OriginCACertificates Types: @@ -334,6 +348,7 @@ Types: ```python from cloudflare.types.zones import ( AdvancedDDoS, + Aegis, AlwaysOnline, AlwaysUseHTTPS, AutomaticHTTPSRewrites, @@ -416,7 +431,8 @@ from cloudflare.types.zones import ZoneHold Methods: - client.zones.holds.create(\*, zone_id, \*\*params) -> ZoneHold -- client.zones.holds.delete(\*, zone_id, \*\*params) -> Optional[ZoneHold] +- client.zones.holds.delete(\*, zone_id, \*\*params) -> ZoneHold +- client.zones.holds.edit(\*, zone_id, \*\*params) -> ZoneHold - client.zones.holds.get(\*, zone_id) -> ZoneHold ## Subscriptions @@ -649,10 +665,10 @@ from cloudflare.types.cache import ( Methods: -- client.cache.cache_reserve.clear(\*, zone_id, \*\*params) -> CacheReserveClearResponse -- client.cache.cache_reserve.edit(\*, zone_id, \*\*params) -> CacheReserveEditResponse -- client.cache.cache_reserve.get(\*, zone_id) -> CacheReserveGetResponse -- client.cache.cache_reserve.status(\*, zone_id) -> CacheReserveStatusResponse +- client.cache.cache_reserve.clear(\*, zone_id, \*\*params) -> Optional[CacheReserveClearResponse] +- client.cache.cache_reserve.edit(\*, zone_id, \*\*params) -> Optional[CacheReserveEditResponse] +- client.cache.cache_reserve.get(\*, zone_id) -> Optional[CacheReserveGetResponse] +- client.cache.cache_reserve.status(\*, zone_id) -> Optional[CacheReserveStatusResponse] ## SmartTieredCache @@ -668,23 +684,28 @@ from cloudflare.types.cache import ( Methods: -- client.cache.smart_tiered_cache.delete(\*, zone_id) -> SmartTieredCacheDeleteResponse -- client.cache.smart_tiered_cache.edit(\*, zone_id, \*\*params) -> SmartTieredCacheEditResponse -- client.cache.smart_tiered_cache.get(\*, zone_id) -> SmartTieredCacheGetResponse +- client.cache.smart_tiered_cache.delete(\*, zone_id) -> Optional[SmartTieredCacheDeleteResponse] +- client.cache.smart_tiered_cache.edit(\*, zone_id, \*\*params) -> Optional[SmartTieredCacheEditResponse] +- client.cache.smart_tiered_cache.get(\*, zone_id) -> Optional[SmartTieredCacheGetResponse] ## Variants Types: ```python -from cloudflare.types.cache import CacheVariant, VariantEditResponse, VariantGetResponse +from cloudflare.types.cache import ( + CacheVariant, + VariantDeleteResponse, + VariantEditResponse, + VariantGetResponse, +) ``` Methods: -- client.cache.variants.delete(\*, zone_id) -> CacheVariant -- client.cache.variants.edit(\*, zone_id, \*\*params) -> VariantEditResponse -- client.cache.variants.get(\*, zone_id) -> VariantGetResponse +- client.cache.variants.delete(\*, zone_id) -> Optional[VariantDeleteResponse] +- client.cache.variants.edit(\*, zone_id, \*\*params) -> Optional[VariantEditResponse] +- client.cache.variants.get(\*, zone_id) -> Optional[VariantGetResponse] ## RegionalTieredCache @@ -700,8 +721,8 @@ from cloudflare.types.cache import ( Methods: -- client.cache.regional_tiered_cache.edit(\*, zone_id, \*\*params) -> RegionalTieredCacheEditResponse -- client.cache.regional_tiered_cache.get(\*, zone_id) -> RegionalTieredCacheGetResponse +- client.cache.regional_tiered_cache.edit(\*, zone_id, \*\*params) -> Optional[RegionalTieredCacheEditResponse] +- client.cache.regional_tiered_cache.get(\*, zone_id) -> Optional[RegionalTieredCacheGetResponse] # SSL @@ -835,8 +856,8 @@ from cloudflare.types.argo import TieredCachingEditResponse, TieredCachingGetRes Methods: -- client.argo.tiered_caching.edit(\*, zone_id, \*\*params) -> TieredCachingEditResponse -- client.argo.tiered_caching.get(\*, zone_id) -> TieredCachingGetResponse +- client.argo.tiered_caching.edit(\*, zone_id, \*\*params) -> Optional[TieredCachingEditResponse] +- client.argo.tiered_caching.get(\*, zone_id) -> Optional[TieredCachingGetResponse] # CertificateAuthorities @@ -1053,6 +1074,8 @@ Types: from cloudflare.types.dns import ( ARecord, AAAARecord, + BatchPatch, + BatchPut, CAARecord, CERTRecord, CNAMERecord, @@ -1065,7 +1088,7 @@ from cloudflare.types.dns import ( NSRecord, PTRRecord, Record, - RecordProcessTiming, + RecordResponse, RecordTags, SMIMEARecord, SRVRecord, @@ -1075,14 +1098,9 @@ from cloudflare.types.dns import ( TTL, TXTRecord, URIRecord, - RecordCreateResponse, - RecordUpdateResponse, - RecordListResponse, RecordDeleteResponse, RecordBatchResponse, - RecordEditResponse, RecordExportResponse, - RecordGetResponse, RecordImportResponse, RecordScanResponse, ) @@ -1090,14 +1108,14 @@ from cloudflare.types.dns import ( Methods: -- client.dns.records.create(\*, zone_id, \*\*params) -> Optional[RecordCreateResponse] -- client.dns.records.update(dns_record_id, \*, zone_id, \*\*params) -> Optional[RecordUpdateResponse] -- client.dns.records.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[RecordListResponse] +- client.dns.records.create(\*, zone_id, \*\*params) -> Optional[RecordResponse] +- client.dns.records.update(dns_record_id, \*, zone_id, \*\*params) -> Optional[RecordResponse] +- client.dns.records.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[RecordResponse] - client.dns.records.delete(dns_record_id, \*, zone_id) -> Optional[RecordDeleteResponse] - client.dns.records.batch(\*, zone_id, \*\*params) -> Optional[RecordBatchResponse] -- client.dns.records.edit(dns_record_id, \*, zone_id, \*\*params) -> Optional[RecordEditResponse] +- client.dns.records.edit(dns_record_id, \*, zone_id, \*\*params) -> Optional[RecordResponse] - client.dns.records.export(\*, zone_id) -> str -- client.dns.records.get(dns_record_id, \*, zone_id) -> Optional[RecordGetResponse] +- client.dns.records.get(dns_record_id, \*, zone_id) -> Optional[RecordResponse] - client.dns.records.import\_(\*, zone_id, \*\*params) -> Optional[RecordImportResponse] - client.dns.records.scan(\*, zone_id, \*\*params) -> Optional[RecordScanResponse] @@ -1912,12 +1930,17 @@ Methods: Types: ```python -from cloudflare.types.logpush import ValidateDestinationResponse, ValidateOriginResponse +from cloudflare.types.logpush import ( + ValidateDestinationResponse, + ValidateDestinationExistsResponse, + ValidateOriginResponse, +) ``` Methods: -- client.logpush.validate.destination(\*, account_id, zone_id, \*\*params) -> Optional[ValidateDestinationResponse] +- client.logpush.validate.destination(\*, account_id, zone_id, \*\*params) -> Optional[ValidateDestinationResponse] +- client.logpush.validate.destination_exists(\*, account_id, zone_id, \*\*params) -> Optional[ValidateDestinationExistsResponse] - client.logpush.validate.origin(\*, account_id, zone_id, \*\*params) -> Optional[ValidateOriginResponse] # Logs @@ -2273,48 +2296,30 @@ Methods: Types: ```python -from cloudflare.types.workers import ( - Binding, - D1Binding, - DispatchNamespaceBinding, - DurableObjectBinding, - KVNamespaceBinding, - MigrationStep, - MTLSCERTBinding, - PlacementConfiguration, - R2Binding, - ServiceBinding, - SingleStepMigration, - SteppedMigration, - WorkerMetadata, -) +from cloudflare.types.workers import MigrationStep, SingleStepMigration, WorkerMetadata ``` -## AI - -Types: - -```python -from cloudflare.types.workers import AIRunResponse -``` - -Methods: - -- client.workers.ai.run(model_name, \*, account_id, \*\*params) -> Optional[AIRunResponse] - -### Models - -#### Schema +## Routes Types: ```python -from cloudflare.types.workers.ai.models import SchemaGetResponse +from cloudflare.types.workers import ( + RouteCreateResponse, + RouteUpdateResponse, + RouteListResponse, + RouteDeleteResponse, + RouteGetResponse, +) ``` Methods: -- client.workers.ai.models.schema.get(\*, account_id, \*\*params) -> object +- client.workers.routes.create(\*, zone_id, \*\*params) -> RouteCreateResponse +- client.workers.routes.update(route_id, \*, zone_id, \*\*params) -> Optional[RouteUpdateResponse] +- client.workers.routes.list(\*, zone_id) -> SyncSinglePage[RouteListResponse] +- client.workers.routes.delete(route_id, \*, zone_id) -> RouteDeleteResponse +- client.workers.routes.get(route_id, \*, zone_id) -> Optional[RouteGetResponse] ## Assets @@ -2335,7 +2340,7 @@ Methods: Types: ```python -from cloudflare.types.workers import Script, ScriptSetting, ScriptUpdateResponse +from cloudflare.types.workers import Script, ScriptSetting, ScriptUpdateResponse, ScriptGetResponse ``` Methods: @@ -2343,7 +2348,7 @@ Methods: - client.workers.scripts.update(script_name, \*, account_id, \*\*params) -> Optional[ScriptUpdateResponse] - client.workers.scripts.list(\*, account_id) -> SyncSinglePage[Script] - client.workers.scripts.delete(script_name, \*, account_id, \*\*params) -> None -- client.workers.scripts.get(script_name, \*, account_id) -> BinaryAPIResponse +- client.workers.scripts.get(script_name, \*, account_id) -> str ### Assets @@ -2692,6 +2697,7 @@ from cloudflare.types.api_gateway import ( OperationCreateResponse, OperationListResponse, OperationDeleteResponse, + OperationBulkCreateResponse, OperationBulkDeleteResponse, OperationGetResponse, ) @@ -2699,9 +2705,10 @@ from cloudflare.types.api_gateway import ( Methods: -- client.api_gateway.operations.create(\*, zone_id, \*\*params) -> OperationCreateResponse +- client.api_gateway.operations.create(\*, zone_id, \*\*params) -> OperationCreateResponse - client.api_gateway.operations.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[OperationListResponse] - client.api_gateway.operations.delete(operation_id, \*, zone_id) -> OperationDeleteResponse +- client.api_gateway.operations.bulk_create(\*, zone_id, \*\*params) -> OperationBulkCreateResponse - client.api_gateway.operations.bulk_delete(\*, zone_id) -> OperationBulkDeleteResponse - client.api_gateway.operations.get(operation_id, \*, zone_id, \*\*params) -> OperationGetResponse @@ -2816,7 +2823,6 @@ Types: ```python from cloudflare.types.managed_transforms import ( - RequestModel, ManagedTransformListResponse, ManagedTransformEditResponse, ) @@ -2825,6 +2831,7 @@ from cloudflare.types.managed_transforms import ( Methods: - client.managed_transforms.list(\*, zone_id) -> ManagedTransformListResponse +- client.managed_transforms.delete(\*, zone_id) -> None - client.managed_transforms.edit(\*, zone_id, \*\*params) -> ManagedTransformEditResponse # PageShield @@ -3016,6 +3023,7 @@ from cloudflare.types.url_normalization import ( Methods: - client.url_normalization.update(\*, zone_id, \*\*params) -> URLNormalizationUpdateResponse +- client.url_normalization.delete(\*, zone_id) -> None - client.url_normalization.get(\*, zone_id) -> URLNormalizationGetResponse # Spectrum @@ -3215,13 +3223,8 @@ from cloudflare.types.addressing import LOADocumentCreateResponse Methods: -- client.addressing.loa_documents.create(\*, account_id, \*\*params) -> Optional[LOADocumentCreateResponse] - -### Downloads - -Methods: - -- client.addressing.loa_documents.downloads.get(loa_document_id, \*, account_id) -> BinaryAPIResponse +- client.addressing.loa_documents.create(\*, account_id, \*\*params) -> Optional[LOADocumentCreateResponse] +- client.addressing.loa_documents.get(loa_document_id, \*, account_id) -> BinaryAPIResponse ## Prefixes @@ -3239,49 +3242,51 @@ Methods: - client.addressing.prefixes.edit(prefix_id, \*, account_id, \*\*params) -> Optional[Prefix] - client.addressing.prefixes.get(prefix_id, \*, account_id) -> Optional[Prefix] -### BGP - -#### Bindings +### ServiceBindings Types: ```python -from cloudflare.types.addressing.prefixes.bgp import ServiceBinding, BindingDeleteResponse +from cloudflare.types.addressing.prefixes import ServiceBinding, ServiceBindingDeleteResponse ``` Methods: -- client.addressing.prefixes.bgp.bindings.create(prefix_id, \*, account_id, \*\*params) -> Optional[ServiceBinding] -- client.addressing.prefixes.bgp.bindings.list(prefix_id, \*, account_id) -> SyncSinglePage[ServiceBinding] -- client.addressing.prefixes.bgp.bindings.delete(binding_id, \*, account_id, prefix_id) -> BindingDeleteResponse -- client.addressing.prefixes.bgp.bindings.get(binding_id, \*, account_id, prefix_id) -> Optional[ServiceBinding] +- client.addressing.prefixes.service_bindings.create(prefix_id, \*, account_id, \*\*params) -> Optional[ServiceBinding] +- client.addressing.prefixes.service_bindings.list(prefix_id, \*, account_id) -> SyncSinglePage[ServiceBinding] +- client.addressing.prefixes.service_bindings.delete(binding_id, \*, account_id, prefix_id) -> ServiceBindingDeleteResponse +- client.addressing.prefixes.service_bindings.get(binding_id, \*, account_id, prefix_id) -> Optional[ServiceBinding] -#### Prefixes +### BGPPrefixes Types: ```python -from cloudflare.types.addressing.prefixes.bgp import BGPPrefix +from cloudflare.types.addressing.prefixes import BGPPrefix ``` Methods: -- client.addressing.prefixes.bgp.prefixes.list(prefix_id, \*, account_id) -> SyncSinglePage[BGPPrefix] -- client.addressing.prefixes.bgp.prefixes.edit(bgp_prefix_id, \*, account_id, prefix_id, \*\*params) -> Optional[BGPPrefix] -- client.addressing.prefixes.bgp.prefixes.get(bgp_prefix_id, \*, account_id, prefix_id) -> Optional[BGPPrefix] +- client.addressing.prefixes.bgp_prefixes.create(prefix_id, \*, account_id, \*\*params) -> Optional[BGPPrefix] +- client.addressing.prefixes.bgp_prefixes.list(prefix_id, \*, account_id) -> SyncSinglePage[BGPPrefix] +- client.addressing.prefixes.bgp_prefixes.edit(bgp_prefix_id, \*, account_id, prefix_id, \*\*params) -> Optional[BGPPrefix] +- client.addressing.prefixes.bgp_prefixes.get(bgp_prefix_id, \*, account_id, prefix_id) -> Optional[BGPPrefix] -#### Statuses +### AdvertisementStatus Types: ```python -from cloudflare.types.addressing.prefixes.bgp import StatusEditResponse, StatusGetResponse +from cloudflare.types.addressing.prefixes import ( + AdvertisementStatusEditResponse, + AdvertisementStatusGetResponse, +) ``` Methods: -- client.addressing.prefixes.bgp.statuses.edit(prefix_id, \*, account_id, \*\*params) -> Optional[StatusEditResponse] -- client.addressing.prefixes.bgp.statuses.get(prefix_id, \*, account_id) -> Optional[StatusGetResponse] +- client.addressing.prefixes.advertisement_status.edit(prefix_id, \*, account_id, \*\*params) -> Optional[AdvertisementStatusEditResponse] +- client.addressing.prefixes.advertisement_status.get(prefix_id, \*, account_id) -> Optional[AdvertisementStatusGetResponse] ### Delegations @@ -4724,6 +4729,20 @@ Methods: - client.workers_for_platforms.dispatch.namespaces.scripts.delete(script_name, \*, account_id, dispatch_namespace, \*\*params) -> None - client.workers_for_platforms.dispatch.namespaces.scripts.get(script_name, \*, account_id, dispatch_namespace) -> Optional[Script] +##### AssetUpload + +Types: + +```python +from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import ( + AssetUploadCreateResponse, +) +``` + +Methods: + +- client.workers_for_platforms.dispatch.namespaces.scripts.asset_upload.create(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Optional[AssetUploadCreateResponse] + ##### Content Methods: @@ -4809,7 +4828,7 @@ from cloudflare.types.zero_trust import Device, DeviceGetResponse Methods: - client.zero_trust.devices.list(\*, account_id) -> SyncSinglePage[Device] -- client.zero_trust.devices.get(device_id, \*, account_id) -> DeviceGetResponse +- client.zero_trust.devices.get(device_id, \*, account_id) -> Optional[DeviceGetResponse] ### DEXTests @@ -4858,7 +4877,7 @@ from cloudflare.types.zero_trust.devices import FleetStatusGetResponse Methods: -- client.zero_trust.devices.fleet_status.get(device_id, \*, account_id, \*\*params) -> FleetStatusGetResponse +- client.zero_trust.devices.fleet_status.get(device_id, \*, account_id, \*\*params) -> FleetStatusGetResponse ### Policies @@ -4949,8 +4968,8 @@ from cloudflare.types.zero_trust.devices.policies.default import ( Methods: -- client.zero_trust.devices.policies.default.certificates.edit(\*, zone_id, \*\*params) -> CertificateEditResponse -- client.zero_trust.devices.policies.default.certificates.get(\*, zone_id) -> CertificateGetResponse +- client.zero_trust.devices.policies.default.certificates.edit(\*, zone_id, \*\*params) -> Optional[CertificateEditResponse] +- client.zero_trust.devices.policies.default.certificates.get(\*, zone_id) -> Optional[CertificateGetResponse] #### Custom @@ -5064,7 +5083,7 @@ Methods: - client.zero_trust.devices.posture.integrations.create(\*, account_id, \*\*params) -> Optional[Integration] - client.zero_trust.devices.posture.integrations.list(\*, account_id) -> SyncSinglePage[Integration] -- client.zero_trust.devices.posture.integrations.delete(integration_id, \*, account_id) -> IntegrationDeleteResponse +- client.zero_trust.devices.posture.integrations.delete(integration_id, \*, account_id) -> Optional[IntegrationDeleteResponse] - client.zero_trust.devices.posture.integrations.edit(integration_id, \*, account_id, \*\*params) -> Optional[Integration] - client.zero_trust.devices.posture.integrations.get(integration_id, \*, account_id) -> Optional[Integration] @@ -5078,7 +5097,7 @@ from cloudflare.types.zero_trust.devices import RevokeCreateResponse Methods: -- client.zero_trust.devices.revoke.create(\*, account_id, \*\*params) -> RevokeCreateResponse +- client.zero_trust.devices.revoke.create(\*, account_id, \*\*params) -> Optional[RevokeCreateResponse] ### Settings @@ -5104,7 +5123,7 @@ from cloudflare.types.zero_trust.devices import UnrevokeCreateResponse Methods: -- client.zero_trust.devices.unrevoke.create(\*, account_id, \*\*params) -> UnrevokeCreateResponse +- client.zero_trust.devices.unrevoke.create(\*, account_id, \*\*params) -> Optional[UnrevokeCreateResponse] ### OverrideCodes @@ -5211,6 +5230,24 @@ from cloudflare.types.zero_trust import ( ) ``` +### GatewayCA + +Types: + +```python +from cloudflare.types.zero_trust.access import ( + GatewayCACreateResponse, + GatewayCAListResponse, + GatewayCADeleteResponse, +) +``` + +Methods: + +- client.zero_trust.access.gateway_ca.create(\*, account_id) -> Optional[GatewayCACreateResponse] +- client.zero_trust.access.gateway_ca.list(\*, account_id) -> SyncSinglePage[GatewayCAListResponse] +- client.zero_trust.access.gateway_ca.delete(certificate_id, \*, account_id) -> Optional[GatewayCADeleteResponse] + ### Infrastructure #### Targets @@ -5614,14 +5651,38 @@ from cloudflare.types.zero_trust.dex import CommandCreateResponse, CommandListRe Methods: -- client.zero_trust.dex.commands.create(\*, account_id, \*\*params) -> Optional[CommandCreateResponse] -- client.zero_trust.dex.commands.list(\*, account_id, \*\*params) -> SyncV4PagePagination[Optional[CommandListResponse]] +- client.zero_trust.dex.commands.create(\*, account_id, \*\*params) -> Optional[CommandCreateResponse] +- client.zero_trust.dex.commands.list(\*, account_id, \*\*params) -> SyncV4PagePagination[Optional[CommandListResponse]] + +#### Users + +Types: + +```python +from cloudflare.types.zero_trust.dex.commands import UserListResponse +``` + +Methods: + +- client.zero_trust.dex.commands.users.list(\*, account_id, \*\*params) -> Optional[UserListResponse] + +#### Devices + +Types: + +```python +from cloudflare.types.zero_trust.dex.commands import DeviceListResponse +``` + +Methods: + +- client.zero_trust.dex.commands.devices.list(\*, account_id, \*\*params) -> SyncV4PagePagination[Optional[DeviceListResponse]] #### Downloads Methods: -- client.zero_trust.dex.commands.downloads.get(filename, \*, account_id, command_id) -> BinaryAPIResponse +- client.zero_trust.dex.commands.downloads.get(filename, \*, account_id, command_id) -> BinaryAPIResponse #### Quota @@ -5633,7 +5694,7 @@ from cloudflare.types.zero_trust.dex.commands import QuotaGetResponse Methods: -- client.zero_trust.dex.commands.quota.get(\*, account_id) -> Optional[QuotaGetResponse] +- client.zero_trust.dex.commands.quota.get(\*, account_id) -> Optional[QuotaGetResponse] ### Colos @@ -5954,6 +6015,48 @@ Methods: - client.zero_trust.dlp.payload_logs.update(\*, account_id, \*\*params) -> Optional[PayloadLogUpdateResponse] - client.zero_trust.dlp.payload_logs.get(\*, account_id) -> Optional[PayloadLogGetResponse] +### Email + +#### AccountMapping + +Types: + +```python +from cloudflare.types.zero_trust.dlp.email import ( + AccountMappingCreateResponse, + AccountMappingGetResponse, +) +``` + +Methods: + +- client.zero_trust.dlp.email.account_mapping.create(\*, account_id, \*\*params) -> Optional[AccountMappingCreateResponse] +- client.zero_trust.dlp.email.account_mapping.get(\*, account_id) -> Optional[AccountMappingGetResponse] + +#### Rules + +Types: + +```python +from cloudflare.types.zero_trust.dlp.email import ( + RuleCreateResponse, + RuleUpdateResponse, + RuleListResponse, + RuleDeleteResponse, + RuleBulkEditResponse, + RuleGetResponse, +) +``` + +Methods: + +- client.zero_trust.dlp.email.rules.create(\*, account_id, \*\*params) -> Optional[RuleCreateResponse] +- client.zero_trust.dlp.email.rules.update(rule_id, \*, account_id, \*\*params) -> Optional[RuleUpdateResponse] +- client.zero_trust.dlp.email.rules.list(\*, account_id) -> SyncSinglePage[RuleListResponse] +- client.zero_trust.dlp.email.rules.delete(rule_id, \*, account_id) -> Optional[RuleDeleteResponse] +- client.zero_trust.dlp.email.rules.bulk_edit(\*, account_id, \*\*params) -> Optional[RuleBulkEditResponse] +- client.zero_trust.dlp.email.rules.get(rule_id, \*, account_id) -> Optional[RuleGetResponse] + ### Profiles Types: @@ -6495,7 +6598,7 @@ Methods: - client.vectorize.indexes.create(\*, account_id, \*\*params) -> Optional[CreateIndex] - client.vectorize.indexes.list(\*, account_id) -> SyncSinglePage[CreateIndex] -- client.vectorize.indexes.delete(index_name, \*, account_id) -> IndexDeleteResponse +- client.vectorize.indexes.delete(index_name, \*, account_id) -> Optional[IndexDeleteResponse] - client.vectorize.indexes.delete_by_ids(index_name, \*, account_id, \*\*params) -> Optional[IndexDeleteByIDsResponse] - client.vectorize.indexes.get(index_name, \*, account_id) -> Optional[CreateIndex] - client.vectorize.indexes.get_by_ids(index_name, \*, account_id, \*\*params) -> object @@ -6540,7 +6643,7 @@ from cloudflare.types.url_scanner import ResponseGetResponse Methods: -- client.url_scanner.responses.get(response_id, \*, account_id) -> str +- client.url_scanner.responses.get(response_id, \*, account_id) -> str ## Scans @@ -6559,13 +6662,13 @@ from cloudflare.types.url_scanner import ( Methods: -- client.url_scanner.scans.create(account_id, \*\*params) -> str -- client.url_scanner.scans.list(account_id, \*\*params) -> ScanListResponse -- client.url_scanner.scans.bulk_create(account_id, \*\*params) -> ScanBulkCreateResponse -- client.url_scanner.scans.dom(scan_id, \*, account_id) -> str -- client.url_scanner.scans.get(scan_id, \*, account_id) -> ScanGetResponse -- client.url_scanner.scans.har(scan_id, \*, account_id) -> ScanHARResponse -- client.url_scanner.scans.screenshot(scan_id, \*, account_id, \*\*params) -> BinaryAPIResponse +- client.url_scanner.scans.create(\*, account_id, \*\*params) -> str +- client.url_scanner.scans.list(\*, account_id, \*\*params) -> ScanListResponse +- client.url_scanner.scans.bulk_create(\*, account_id, \*\*params) -> ScanBulkCreateResponse +- client.url_scanner.scans.dom(scan_id, \*, account_id) -> str +- client.url_scanner.scans.get(scan_id, \*, account_id) -> ScanGetResponse +- client.url_scanner.scans.har(scan_id, \*, account_id) -> ScanHARResponse +- client.url_scanner.scans.screenshot(scan_id, \*, account_id, \*\*params) -> BinaryAPIResponse # Radar @@ -7740,8 +7843,8 @@ from cloudflare.types.origin_post_quantum_encryption import ( Methods: -- client.origin_post_quantum_encryption.update(\*, zone_id, \*\*params) -> OriginPostQuantumEncryptionUpdateResponse -- client.origin_post_quantum_encryption.get(\*, zone_id) -> OriginPostQuantumEncryptionGetResponse +- client.origin_post_quantum_encryption.update(\*, zone_id, \*\*params) -> Optional[OriginPostQuantumEncryptionUpdateResponse] +- client.origin_post_quantum_encryption.get(\*, zone_id) -> Optional[OriginPostQuantumEncryptionGetResponse] # Speed @@ -8415,3 +8518,112 @@ from cloudflare.types.content_scanning import SettingGetResponse Methods: - client.content_scanning.settings.get(\*, zone_id) -> SettingGetResponse + +# AbuseReports + +Types: + +```python +from cloudflare.types.abuse_reports import AbuseReportCreateResponse +``` + +Methods: + +- client.abuse_reports.create(report_type, \*, account_id, \*\*params) -> str + +# AI + +Types: + +```python +from cloudflare.types.ai import AIRunResponse +``` + +Methods: + +- client.ai.run(model_name, \*, account_id, \*\*params) -> Optional[AIRunResponse] + +## Finetunes + +Types: + +```python +from cloudflare.types.ai import FinetuneCreateResponse, FinetuneListResponse +``` + +Methods: + +- client.ai.finetunes.create(\*, account_id, \*\*params) -> FinetuneCreateResponse +- client.ai.finetunes.list(\*, account_id) -> FinetuneListResponse + +### Assets + +Types: + +```python +from cloudflare.types.ai.finetunes import AssetCreateResponse +``` + +Methods: + +- client.ai.finetunes.assets.create(finetune_id, \*, account_id, \*\*params) -> AssetCreateResponse + +### Public + +Types: + +```python +from cloudflare.types.ai.finetunes import PublicListResponse +``` + +Methods: + +- client.ai.finetunes.public.list(\*, account_id, \*\*params) -> SyncSinglePage[PublicListResponse] + +## Authors + +Types: + +```python +from cloudflare.types.ai import AuthorListResponse +``` + +Methods: + +- client.ai.authors.list(\*, account_id) -> SyncSinglePage[object] + +## Tasks + +Types: + +```python +from cloudflare.types.ai import TaskListResponse +``` + +Methods: + +- client.ai.tasks.list(\*, account_id) -> SyncSinglePage[object] + +## Models + +Types: + +```python +from cloudflare.types.ai import ModelListResponse +``` + +Methods: + +- client.ai.models.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[object] + +### Schema + +Types: + +```python +from cloudflare.types.ai.models import SchemaGetResponse +``` + +Methods: + +- client.ai.models.schema.get(\*, account_id, \*\*params) -> object diff --git a/src/cloudflare/_client.py b/src/cloudflare/_client.py index c3804a44877..f48b5ae2359 100644 --- a/src/cloudflare/_client.py +++ b/src/cloudflare/_client.py @@ -36,6 +36,7 @@ if TYPE_CHECKING: from .resources import ( + ai, d1, kv, r2, @@ -91,6 +92,7 @@ dns_firewall, healthchecks, security_txt, + abuse_reports, email_routing, magic_transit, waiting_rooms, @@ -122,6 +124,7 @@ origin_post_quantum_encryption, ) from .resources.ips import IPsResource, AsyncIPsResource + from .resources.ai.ai import AIResource, AsyncAIResource from .resources.d1.d1 import D1Resource, AsyncD1Resource from .resources.kv.kv import KVResource, AsyncKVResource from .resources.r2.r2 import R2Resource, AsyncR2Resource @@ -148,6 +151,7 @@ from .resources.speed.speed import SpeedResource, AsyncSpeedResource from .resources.zones.zones import ZonesResource, AsyncZonesResource from .resources.security_txt import SecurityTXTResource, AsyncSecurityTXTResource + from .resources.abuse_reports import AbuseReportsResource, AsyncAbuseReportsResource from .resources.images.images import ImagesResource, AsyncImagesResource from .resources.queues.queues import QueuesResource, AsyncQueuesResource from .resources.stream.stream import StreamResource, AsyncStreamResource @@ -816,6 +820,18 @@ def content_scanning(self) -> ContentScanningResource: return ContentScanningResource(self) + @cached_property + def abuse_reports(self) -> AbuseReportsResource: + from .resources.abuse_reports import AbuseReportsResource + + return AbuseReportsResource(self) + + @cached_property + def ai(self) -> AIResource: + from .resources.ai import AIResource + + return AIResource(self) + @cached_property def with_raw_response(self) -> CloudflareWithRawResponse: return CloudflareWithRawResponse(self) @@ -1575,6 +1591,18 @@ def content_scanning(self) -> AsyncContentScanningResource: return AsyncContentScanningResource(self) + @cached_property + def abuse_reports(self) -> AsyncAbuseReportsResource: + from .resources.abuse_reports import AsyncAbuseReportsResource + + return AsyncAbuseReportsResource(self) + + @cached_property + def ai(self) -> AsyncAIResource: + from .resources.ai import AsyncAIResource + + return AsyncAIResource(self) + @cached_property def with_raw_response(self) -> AsyncCloudflareWithRawResponse: return AsyncCloudflareWithRawResponse(self) @@ -2269,6 +2297,18 @@ def content_scanning(self) -> content_scanning.ContentScanningResourceWithRawRes return ContentScanningResourceWithRawResponse(self._client.content_scanning) + @cached_property + def abuse_reports(self) -> abuse_reports.AbuseReportsResourceWithRawResponse: + from .resources.abuse_reports import AbuseReportsResourceWithRawResponse + + return AbuseReportsResourceWithRawResponse(self._client.abuse_reports) + + @cached_property + def ai(self) -> ai.AIResourceWithRawResponse: + from .resources.ai import AIResourceWithRawResponse + + return AIResourceWithRawResponse(self._client.ai) + class AsyncCloudflareWithRawResponse: _client: AsyncCloudflare @@ -2782,6 +2822,18 @@ def content_scanning(self) -> content_scanning.AsyncContentScanningResourceWithR return AsyncContentScanningResourceWithRawResponse(self._client.content_scanning) + @cached_property + def abuse_reports(self) -> abuse_reports.AsyncAbuseReportsResourceWithRawResponse: + from .resources.abuse_reports import AsyncAbuseReportsResourceWithRawResponse + + return AsyncAbuseReportsResourceWithRawResponse(self._client.abuse_reports) + + @cached_property + def ai(self) -> ai.AsyncAIResourceWithRawResponse: + from .resources.ai import AsyncAIResourceWithRawResponse + + return AsyncAIResourceWithRawResponse(self._client.ai) + class CloudflareWithStreamedResponse: _client: Cloudflare @@ -3295,6 +3347,18 @@ def content_scanning(self) -> content_scanning.ContentScanningResourceWithStream return ContentScanningResourceWithStreamingResponse(self._client.content_scanning) + @cached_property + def abuse_reports(self) -> abuse_reports.AbuseReportsResourceWithStreamingResponse: + from .resources.abuse_reports import AbuseReportsResourceWithStreamingResponse + + return AbuseReportsResourceWithStreamingResponse(self._client.abuse_reports) + + @cached_property + def ai(self) -> ai.AIResourceWithStreamingResponse: + from .resources.ai import AIResourceWithStreamingResponse + + return AIResourceWithStreamingResponse(self._client.ai) + class AsyncCloudflareWithStreamedResponse: _client: AsyncCloudflare @@ -3818,6 +3882,18 @@ def content_scanning(self) -> content_scanning.AsyncContentScanningResourceWithS return AsyncContentScanningResourceWithStreamingResponse(self._client.content_scanning) + @cached_property + def abuse_reports(self) -> abuse_reports.AsyncAbuseReportsResourceWithStreamingResponse: + from .resources.abuse_reports import AsyncAbuseReportsResourceWithStreamingResponse + + return AsyncAbuseReportsResourceWithStreamingResponse(self._client.abuse_reports) + + @cached_property + def ai(self) -> ai.AsyncAIResourceWithStreamingResponse: + from .resources.ai import AsyncAIResourceWithStreamingResponse + + return AsyncAIResourceWithStreamingResponse(self._client.ai) + Client = Cloudflare diff --git a/src/cloudflare/resources/abuse_reports.py b/src/cloudflare/resources/abuse_reports.py new file mode 100644 index 00000000000..a81ce3c43a6 --- /dev/null +++ b/src/cloudflare/resources/abuse_reports.py @@ -0,0 +1,492 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import 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 .._base_client import make_request_options +from ..types.abuse_reports import abuse_report_create_params +from ..types.abuse_reports.abuse_report_create_response import AbuseReportCreateResponse + +__all__ = ["AbuseReportsResource", "AsyncAbuseReportsResource"] + + +class AbuseReportsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AbuseReportsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AbuseReportsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AbuseReportsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AbuseReportsResourceWithStreamingResponse(self) + + def create( + self, + report_type: Literal[ + "abuse_dmca", + "abuse_trademark", + "abuse_general", + "abuse_phishing", + "abuse_children", + "abuse_threat", + "abuse_registrar_whois", + "abuse_ncsei", + ], + *, + account_id: str, + act: Literal[ + "abuse_dmca", + "abuse_trademark", + "abuse_general", + "abuse_phishing", + "abuse_children", + "abuse_threat", + "abuse_registrar_whois", + "abuse_ncsei", + ], + email: str, + email2: str, + host_notification: Literal["send", "send-anon", "none"], + ncmec_notification: Literal["send", "send-anon", "none"], + owner_notification: Literal["send", "send-anon", "none"], + urls: str, + address1: str | NotGiven = NOT_GIVEN, + agent_name: str | NotGiven = NOT_GIVEN, + agree: Literal[0, 1] | NotGiven = NOT_GIVEN, + city: str | NotGiven = NOT_GIVEN, + comments: str | NotGiven = NOT_GIVEN, + company: str | NotGiven = NOT_GIVEN, + country: str | NotGiven = NOT_GIVEN, + destination_ips: str | NotGiven = NOT_GIVEN, + justification: str | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, + original_work: str | NotGiven = NOT_GIVEN, + ports_protocols: str | NotGiven = NOT_GIVEN, + signature: str | NotGiven = NOT_GIVEN, + source_ips: str | NotGiven = NOT_GIVEN, + state: str | NotGiven = NOT_GIVEN, + tele: str | NotGiven = NOT_GIVEN, + title: str | NotGiven = NOT_GIVEN, + trademark_number: str | NotGiven = NOT_GIVEN, + trademark_office: str | NotGiven = NOT_GIVEN, + trademark_symbol: 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, + ) -> str: + """ + Submit the Abuse Report of a particular type + + Args: + report_type: The abuse report type + + act: The abuse report type + + email: A valid email of the abuse reporter + + email2: Should match the value provided in `email` + + host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + + ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + + owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + + urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs + should not exceed 250 URLs. All URLs should have the same hostname. Each URL + should be unique + + address1: Text not exceeding 100 characters + + agent_name: The name of the copyright holder. Text not exceeding 60 characters. + + agree: Can be 0 or 1 + + city: Text not exceeding 255 characters + + comments: Any additional comments about the infringement not exceeding 2000 characters + + company: Text not exceeding 100 characters + + country: Text not exceeding 255 characters + + destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of + destination IPs should not exceed 30 IP addresses. Each one of the IP addresses + ought to be unique + + justification: A detailed description of the infringement, including any necessary access + details and the exact steps needed to view the content, not exceeding 5000 + characters + + name: Text not exceeding 255 characters + + ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report + + original_work: Text not exceeding 255 characters + + ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total + size of the field should not exceed 2000 characters. Each individual + port/protocol should not exceed 100 characters. The list should not have more + than 30 unique ports and protocols. + + signature: Required for DMCA reports, should be same as Name. An affirmation that all + information in the report is true and accurate while agreeing to the policies of + Cloudflare's abuse reports + + source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source + IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be + unique + + state: Text not exceeding 255 characters + + tele: Text not exceeding 20 characters + + title: Text not exceeding 255 characters + + trademark_number: Text not exceeding 1000 characters + + trademark_office: Text not exceeding 1000 characters + + trademark_symbol: Text not exceeding 1000 characters + + 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 report_type: + raise ValueError(f"Expected a non-empty value for `report_type` but received {report_type!r}") + return self._post( + f"/accounts/{account_id}/abuse-reports/{report_type}", + body=maybe_transform( + { + "act": act, + "email": email, + "email2": email2, + "host_notification": host_notification, + "ncmec_notification": ncmec_notification, + "owner_notification": owner_notification, + "urls": urls, + "address1": address1, + "agent_name": agent_name, + "agree": agree, + "city": city, + "comments": comments, + "company": company, + "country": country, + "destination_ips": destination_ips, + "justification": justification, + "name": name, + "ncsei_subject_representation": ncsei_subject_representation, + "original_work": original_work, + "ports_protocols": ports_protocols, + "signature": signature, + "source_ips": source_ips, + "state": state, + "tele": tele, + "title": title, + "trademark_number": trademark_number, + "trademark_office": trademark_office, + "trademark_symbol": trademark_symbol, + }, + abuse_report_create_params.AbuseReportCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[AbuseReportCreateResponse]._unwrapper, + ), + cast_to=cast(Type[str], ResultWrapper[str]), + ) + + +class AsyncAbuseReportsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAbuseReportsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncAbuseReportsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAbuseReportsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncAbuseReportsResourceWithStreamingResponse(self) + + async def create( + self, + report_type: Literal[ + "abuse_dmca", + "abuse_trademark", + "abuse_general", + "abuse_phishing", + "abuse_children", + "abuse_threat", + "abuse_registrar_whois", + "abuse_ncsei", + ], + *, + account_id: str, + act: Literal[ + "abuse_dmca", + "abuse_trademark", + "abuse_general", + "abuse_phishing", + "abuse_children", + "abuse_threat", + "abuse_registrar_whois", + "abuse_ncsei", + ], + email: str, + email2: str, + host_notification: Literal["send", "send-anon", "none"], + ncmec_notification: Literal["send", "send-anon", "none"], + owner_notification: Literal["send", "send-anon", "none"], + urls: str, + address1: str | NotGiven = NOT_GIVEN, + agent_name: str | NotGiven = NOT_GIVEN, + agree: Literal[0, 1] | NotGiven = NOT_GIVEN, + city: str | NotGiven = NOT_GIVEN, + comments: str | NotGiven = NOT_GIVEN, + company: str | NotGiven = NOT_GIVEN, + country: str | NotGiven = NOT_GIVEN, + destination_ips: str | NotGiven = NOT_GIVEN, + justification: str | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, + original_work: str | NotGiven = NOT_GIVEN, + ports_protocols: str | NotGiven = NOT_GIVEN, + signature: str | NotGiven = NOT_GIVEN, + source_ips: str | NotGiven = NOT_GIVEN, + state: str | NotGiven = NOT_GIVEN, + tele: str | NotGiven = NOT_GIVEN, + title: str | NotGiven = NOT_GIVEN, + trademark_number: str | NotGiven = NOT_GIVEN, + trademark_office: str | NotGiven = NOT_GIVEN, + trademark_symbol: 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, + ) -> str: + """ + Submit the Abuse Report of a particular type + + Args: + report_type: The abuse report type + + act: The abuse report type + + email: A valid email of the abuse reporter + + email2: Should match the value provided in `email` + + host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + + ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + + owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + + urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs + should not exceed 250 URLs. All URLs should have the same hostname. Each URL + should be unique + + address1: Text not exceeding 100 characters + + agent_name: The name of the copyright holder. Text not exceeding 60 characters. + + agree: Can be 0 or 1 + + city: Text not exceeding 255 characters + + comments: Any additional comments about the infringement not exceeding 2000 characters + + company: Text not exceeding 100 characters + + country: Text not exceeding 255 characters + + destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of + destination IPs should not exceed 30 IP addresses. Each one of the IP addresses + ought to be unique + + justification: A detailed description of the infringement, including any necessary access + details and the exact steps needed to view the content, not exceeding 5000 + characters + + name: Text not exceeding 255 characters + + ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report + + original_work: Text not exceeding 255 characters + + ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total + size of the field should not exceed 2000 characters. Each individual + port/protocol should not exceed 100 characters. The list should not have more + than 30 unique ports and protocols. + + signature: Required for DMCA reports, should be same as Name. An affirmation that all + information in the report is true and accurate while agreeing to the policies of + Cloudflare's abuse reports + + source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source + IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be + unique + + state: Text not exceeding 255 characters + + tele: Text not exceeding 20 characters + + title: Text not exceeding 255 characters + + trademark_number: Text not exceeding 1000 characters + + trademark_office: Text not exceeding 1000 characters + + trademark_symbol: Text not exceeding 1000 characters + + 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 report_type: + raise ValueError(f"Expected a non-empty value for `report_type` but received {report_type!r}") + return await self._post( + f"/accounts/{account_id}/abuse-reports/{report_type}", + body=await async_maybe_transform( + { + "act": act, + "email": email, + "email2": email2, + "host_notification": host_notification, + "ncmec_notification": ncmec_notification, + "owner_notification": owner_notification, + "urls": urls, + "address1": address1, + "agent_name": agent_name, + "agree": agree, + "city": city, + "comments": comments, + "company": company, + "country": country, + "destination_ips": destination_ips, + "justification": justification, + "name": name, + "ncsei_subject_representation": ncsei_subject_representation, + "original_work": original_work, + "ports_protocols": ports_protocols, + "signature": signature, + "source_ips": source_ips, + "state": state, + "tele": tele, + "title": title, + "trademark_number": trademark_number, + "trademark_office": trademark_office, + "trademark_symbol": trademark_symbol, + }, + abuse_report_create_params.AbuseReportCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[AbuseReportCreateResponse]._unwrapper, + ), + cast_to=cast(Type[str], ResultWrapper[str]), + ) + + +class AbuseReportsResourceWithRawResponse: + def __init__(self, abuse_reports: AbuseReportsResource) -> None: + self._abuse_reports = abuse_reports + + self.create = to_raw_response_wrapper( + abuse_reports.create, + ) + + +class AsyncAbuseReportsResourceWithRawResponse: + def __init__(self, abuse_reports: AsyncAbuseReportsResource) -> None: + self._abuse_reports = abuse_reports + + self.create = async_to_raw_response_wrapper( + abuse_reports.create, + ) + + +class AbuseReportsResourceWithStreamingResponse: + def __init__(self, abuse_reports: AbuseReportsResource) -> None: + self._abuse_reports = abuse_reports + + self.create = to_streamed_response_wrapper( + abuse_reports.create, + ) + + +class AsyncAbuseReportsResourceWithStreamingResponse: + def __init__(self, abuse_reports: AsyncAbuseReportsResource) -> None: + self._abuse_reports = abuse_reports + + self.create = async_to_streamed_response_wrapper( + abuse_reports.create, + ) diff --git a/src/cloudflare/resources/accounts/__init__.py b/src/cloudflare/resources/accounts/__init__.py index f91d884a2b2..f136ec47000 100644 --- a/src/cloudflare/resources/accounts/__init__.py +++ b/src/cloudflare/resources/accounts/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .logs import ( + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, +) from .roles import ( RolesResource, AsyncRolesResource, @@ -66,6 +74,12 @@ "AsyncTokensResourceWithRawResponse", "TokensResourceWithStreamingResponse", "AsyncTokensResourceWithStreamingResponse", + "LogsResource", + "AsyncLogsResource", + "LogsResourceWithRawResponse", + "AsyncLogsResourceWithRawResponse", + "LogsResourceWithStreamingResponse", + "AsyncLogsResourceWithStreamingResponse", "AccountsResource", "AsyncAccountsResource", "AccountsResourceWithRawResponse", diff --git a/src/cloudflare/resources/accounts/accounts.py b/src/cloudflare/resources/accounts/accounts.py index e6e9d0721a4..eba792cbcc5 100644 --- a/src/cloudflare/resources/accounts/accounts.py +++ b/src/cloudflare/resources/accounts/accounts.py @@ -29,6 +29,14 @@ async_maybe_transform, ) from ..._compat import cached_property +from .logs.logs import ( + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, +) from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( to_raw_response_wrapper, @@ -79,6 +87,10 @@ def subscriptions(self) -> SubscriptionsResource: def tokens(self) -> TokensResource: return TokensResource(self._client) + @cached_property + def logs(self) -> LogsResource: + return LogsResource(self._client) + @cached_property def with_raw_response(self) -> AccountsResourceWithRawResponse: """ @@ -358,6 +370,10 @@ def subscriptions(self) -> AsyncSubscriptionsResource: def tokens(self) -> AsyncTokensResource: return AsyncTokensResource(self._client) + @cached_property + def logs(self) -> AsyncLogsResource: + return AsyncLogsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncAccountsResourceWithRawResponse: """ @@ -656,6 +672,10 @@ def subscriptions(self) -> SubscriptionsResourceWithRawResponse: def tokens(self) -> TokensResourceWithRawResponse: return TokensResourceWithRawResponse(self._accounts.tokens) + @cached_property + def logs(self) -> LogsResourceWithRawResponse: + return LogsResourceWithRawResponse(self._accounts.logs) + class AsyncAccountsResourceWithRawResponse: def __init__(self, accounts: AsyncAccountsResource) -> None: @@ -693,6 +713,10 @@ def subscriptions(self) -> AsyncSubscriptionsResourceWithRawResponse: def tokens(self) -> AsyncTokensResourceWithRawResponse: return AsyncTokensResourceWithRawResponse(self._accounts.tokens) + @cached_property + def logs(self) -> AsyncLogsResourceWithRawResponse: + return AsyncLogsResourceWithRawResponse(self._accounts.logs) + class AccountsResourceWithStreamingResponse: def __init__(self, accounts: AccountsResource) -> None: @@ -730,6 +754,10 @@ def subscriptions(self) -> SubscriptionsResourceWithStreamingResponse: def tokens(self) -> TokensResourceWithStreamingResponse: return TokensResourceWithStreamingResponse(self._accounts.tokens) + @cached_property + def logs(self) -> LogsResourceWithStreamingResponse: + return LogsResourceWithStreamingResponse(self._accounts.logs) + class AsyncAccountsResourceWithStreamingResponse: def __init__(self, accounts: AsyncAccountsResource) -> None: @@ -766,3 +794,7 @@ def subscriptions(self) -> AsyncSubscriptionsResourceWithStreamingResponse: @cached_property def tokens(self) -> AsyncTokensResourceWithStreamingResponse: return AsyncTokensResourceWithStreamingResponse(self._accounts.tokens) + + @cached_property + def logs(self) -> AsyncLogsResourceWithStreamingResponse: + return AsyncLogsResourceWithStreamingResponse(self._accounts.logs) diff --git a/src/cloudflare/resources/accounts/logs/__init__.py b/src/cloudflare/resources/accounts/logs/__init__.py new file mode 100644 index 00000000000..5d5ddcdb7e2 --- /dev/null +++ b/src/cloudflare/resources/accounts/logs/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .logs import ( + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, +) +from .audit import ( + AuditResource, + AsyncAuditResource, + AuditResourceWithRawResponse, + AsyncAuditResourceWithRawResponse, + AuditResourceWithStreamingResponse, + AsyncAuditResourceWithStreamingResponse, +) + +__all__ = [ + "AuditResource", + "AsyncAuditResource", + "AuditResourceWithRawResponse", + "AsyncAuditResourceWithRawResponse", + "AuditResourceWithStreamingResponse", + "AsyncAuditResourceWithStreamingResponse", + "LogsResource", + "AsyncLogsResource", + "LogsResourceWithRawResponse", + "AsyncLogsResourceWithRawResponse", + "LogsResourceWithStreamingResponse", + "AsyncLogsResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/accounts/logs/audit.py b/src/cloudflare/resources/accounts/logs/audit.py new file mode 100644 index 00000000000..7375f4199ec --- /dev/null +++ b/src/cloudflare/resources/accounts/logs/audit.py @@ -0,0 +1,426 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import date +from typing_extensions import Literal + +import httpx + +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 SyncCursorLimitPagination, AsyncCursorLimitPagination +from ...._base_client import AsyncPaginator, make_request_options +from ....types.accounts.logs import audit_list_params +from ....types.accounts.logs.audit_list_response import AuditListResponse + +__all__ = ["AuditResource", "AsyncAuditResource"] + + +class AuditResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AuditResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AuditResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AuditResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AuditResourceWithStreamingResponse(self) + + def list( + self, + *, + account_id: str, + before: Union[str, date], + since: Union[str, date], + account_name: str | NotGiven = NOT_GIVEN, + action_result: Literal["success", "failure"] | NotGiven = NOT_GIVEN, + action_type: Literal["create", "delete", "view", "update"] | NotGiven = NOT_GIVEN, + actor_context: Literal["api_key", "api_token", "dash", "oauth", "origin_ca_key"] | NotGiven = NOT_GIVEN, + actor_email: str | NotGiven = NOT_GIVEN, + actor_id: str | NotGiven = NOT_GIVEN, + actor_ip_address: str | NotGiven = NOT_GIVEN, + actor_token_id: str | NotGiven = NOT_GIVEN, + actor_token_name: str | NotGiven = NOT_GIVEN, + actor_type: Literal["cloudflare_admin", "account", "user"] | NotGiven = NOT_GIVEN, + audit_log_id: str | NotGiven = NOT_GIVEN, + cursor: str | NotGiven = NOT_GIVEN, + direction: Literal["desc", "asc"] | NotGiven = NOT_GIVEN, + limit: float | NotGiven = NOT_GIVEN, + raw_cf_rayid: str | NotGiven = NOT_GIVEN, + raw_method: str | NotGiven = NOT_GIVEN, + raw_status_code: int | NotGiven = NOT_GIVEN, + raw_uri: str | NotGiven = NOT_GIVEN, + resource_id: str | NotGiven = NOT_GIVEN, + resource_product: str | NotGiven = NOT_GIVEN, + resource_scope: Literal["accounts", "user", "zones"] | NotGiven = NOT_GIVEN, + resource_type: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + zone_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, + ) -> SyncCursorLimitPagination[AuditListResponse]: + """Gets a list of audit logs for an account. + +

This is the beta release + of Audit Logs Version 2. Since this is a beta version, there may be gaps or + missing entries in the available audit logs. Be aware of the following + limitations.
+ + Args: + account_id: The unique id that identifies the account. + + before: Filters actions based on a given timestamp in the format yyyy-mm-dd, returning + only logs that occurred on and before the specified date. + + since: Filters actions based on a given timestamp in the format yyyy-mm-dd, returning + only logs that occurred on and after the specified date. + + account_name: Filters by the account name. + + action_result: Whether the action was successful or not. + + action_type: Filters by the action type. + + actor_context: Filters by the actor context. + + actor_email: Filters by the actor's email address. + + actor_id: Filters by the actor ID. This can be either the Account ID or User ID. + + actor_ip_address: The IP address where the action was initiated. + + actor_token_id: Filters by the API token ID when the actor context is an api_token or oauth. + + actor_token_name: Filters by the API token name when the actor context is an api_token or oauth. + + actor_type: Filters by the actor type. + + audit_log_id: Finds a specific log by its ID. + + cursor: The cursor is an opaque token used to paginate through large sets of records. It + indicates the position from which to continue when requesting the next set of + records. A valid cursor value can be obtained from the cursor object in the + result_info structure of a previous response. + + direction: Sets sorting order. + + limit: The number limits the objects to return. The cursor attribute may be used to + iterate over the next batch of objects if there are more than the limit. + + raw_cf_rayid: Filters by the response CF Ray ID. + + raw_method: The HTTP method for the API call. + + raw_status_code: The response status code that was returned. + + raw_uri: Filters by the request URI. + + resource_id: Filters by the resource ID. + + resource_product: Filters audit logs by the Cloudflare product associated with the changed + resource. + + resource_scope: Filters by the resource scope, specifying whether the resource is associated + with an user, an account, or a zone. + + resource_type: Filters audit logs based on the unique type of resource changed by the action. + + zone_id: Filters by the zone ID. + + zone_name: Filters by the zone name associated with the change. + + 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}/logs/audit", + page=SyncCursorLimitPagination[AuditListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "before": before, + "since": since, + "account_name": account_name, + "action_result": action_result, + "action_type": action_type, + "actor_context": actor_context, + "actor_email": actor_email, + "actor_id": actor_id, + "actor_ip_address": actor_ip_address, + "actor_token_id": actor_token_id, + "actor_token_name": actor_token_name, + "actor_type": actor_type, + "audit_log_id": audit_log_id, + "cursor": cursor, + "direction": direction, + "limit": limit, + "raw_cf_rayid": raw_cf_rayid, + "raw_method": raw_method, + "raw_status_code": raw_status_code, + "raw_uri": raw_uri, + "resource_id": resource_id, + "resource_product": resource_product, + "resource_scope": resource_scope, + "resource_type": resource_type, + "zone_id": zone_id, + "zone_name": zone_name, + }, + audit_list_params.AuditListParams, + ), + ), + model=AuditListResponse, + ) + + +class AsyncAuditResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAuditResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncAuditResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAuditResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncAuditResourceWithStreamingResponse(self) + + def list( + self, + *, + account_id: str, + before: Union[str, date], + since: Union[str, date], + account_name: str | NotGiven = NOT_GIVEN, + action_result: Literal["success", "failure"] | NotGiven = NOT_GIVEN, + action_type: Literal["create", "delete", "view", "update"] | NotGiven = NOT_GIVEN, + actor_context: Literal["api_key", "api_token", "dash", "oauth", "origin_ca_key"] | NotGiven = NOT_GIVEN, + actor_email: str | NotGiven = NOT_GIVEN, + actor_id: str | NotGiven = NOT_GIVEN, + actor_ip_address: str | NotGiven = NOT_GIVEN, + actor_token_id: str | NotGiven = NOT_GIVEN, + actor_token_name: str | NotGiven = NOT_GIVEN, + actor_type: Literal["cloudflare_admin", "account", "user"] | NotGiven = NOT_GIVEN, + audit_log_id: str | NotGiven = NOT_GIVEN, + cursor: str | NotGiven = NOT_GIVEN, + direction: Literal["desc", "asc"] | NotGiven = NOT_GIVEN, + limit: float | NotGiven = NOT_GIVEN, + raw_cf_rayid: str | NotGiven = NOT_GIVEN, + raw_method: str | NotGiven = NOT_GIVEN, + raw_status_code: int | NotGiven = NOT_GIVEN, + raw_uri: str | NotGiven = NOT_GIVEN, + resource_id: str | NotGiven = NOT_GIVEN, + resource_product: str | NotGiven = NOT_GIVEN, + resource_scope: Literal["accounts", "user", "zones"] | NotGiven = NOT_GIVEN, + resource_type: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + zone_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, + ) -> AsyncPaginator[AuditListResponse, AsyncCursorLimitPagination[AuditListResponse]]: + """Gets a list of audit logs for an account. + +

This is the beta release + of Audit Logs Version 2. Since this is a beta version, there may be gaps or + missing entries in the available audit logs. Be aware of the following + limitations.
+ + Args: + account_id: The unique id that identifies the account. + + before: Filters actions based on a given timestamp in the format yyyy-mm-dd, returning + only logs that occurred on and before the specified date. + + since: Filters actions based on a given timestamp in the format yyyy-mm-dd, returning + only logs that occurred on and after the specified date. + + account_name: Filters by the account name. + + action_result: Whether the action was successful or not. + + action_type: Filters by the action type. + + actor_context: Filters by the actor context. + + actor_email: Filters by the actor's email address. + + actor_id: Filters by the actor ID. This can be either the Account ID or User ID. + + actor_ip_address: The IP address where the action was initiated. + + actor_token_id: Filters by the API token ID when the actor context is an api_token or oauth. + + actor_token_name: Filters by the API token name when the actor context is an api_token or oauth. + + actor_type: Filters by the actor type. + + audit_log_id: Finds a specific log by its ID. + + cursor: The cursor is an opaque token used to paginate through large sets of records. It + indicates the position from which to continue when requesting the next set of + records. A valid cursor value can be obtained from the cursor object in the + result_info structure of a previous response. + + direction: Sets sorting order. + + limit: The number limits the objects to return. The cursor attribute may be used to + iterate over the next batch of objects if there are more than the limit. + + raw_cf_rayid: Filters by the response CF Ray ID. + + raw_method: The HTTP method for the API call. + + raw_status_code: The response status code that was returned. + + raw_uri: Filters by the request URI. + + resource_id: Filters by the resource ID. + + resource_product: Filters audit logs by the Cloudflare product associated with the changed + resource. + + resource_scope: Filters by the resource scope, specifying whether the resource is associated + with an user, an account, or a zone. + + resource_type: Filters audit logs based on the unique type of resource changed by the action. + + zone_id: Filters by the zone ID. + + zone_name: Filters by the zone name associated with the change. + + 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}/logs/audit", + page=AsyncCursorLimitPagination[AuditListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "before": before, + "since": since, + "account_name": account_name, + "action_result": action_result, + "action_type": action_type, + "actor_context": actor_context, + "actor_email": actor_email, + "actor_id": actor_id, + "actor_ip_address": actor_ip_address, + "actor_token_id": actor_token_id, + "actor_token_name": actor_token_name, + "actor_type": actor_type, + "audit_log_id": audit_log_id, + "cursor": cursor, + "direction": direction, + "limit": limit, + "raw_cf_rayid": raw_cf_rayid, + "raw_method": raw_method, + "raw_status_code": raw_status_code, + "raw_uri": raw_uri, + "resource_id": resource_id, + "resource_product": resource_product, + "resource_scope": resource_scope, + "resource_type": resource_type, + "zone_id": zone_id, + "zone_name": zone_name, + }, + audit_list_params.AuditListParams, + ), + ), + model=AuditListResponse, + ) + + +class AuditResourceWithRawResponse: + def __init__(self, audit: AuditResource) -> None: + self._audit = audit + + self.list = to_raw_response_wrapper( + audit.list, + ) + + +class AsyncAuditResourceWithRawResponse: + def __init__(self, audit: AsyncAuditResource) -> None: + self._audit = audit + + self.list = async_to_raw_response_wrapper( + audit.list, + ) + + +class AuditResourceWithStreamingResponse: + def __init__(self, audit: AuditResource) -> None: + self._audit = audit + + self.list = to_streamed_response_wrapper( + audit.list, + ) + + +class AsyncAuditResourceWithStreamingResponse: + def __init__(self, audit: AsyncAuditResource) -> None: + self._audit = audit + + self.list = async_to_streamed_response_wrapper( + audit.list, + ) diff --git a/src/cloudflare/resources/accounts/logs/logs.py b/src/cloudflare/resources/accounts/logs/logs.py new file mode 100644 index 00000000000..475921543aa --- /dev/null +++ b/src/cloudflare/resources/accounts/logs/logs.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .audit import ( + AuditResource, + AsyncAuditResource, + AuditResourceWithRawResponse, + AsyncAuditResourceWithRawResponse, + AuditResourceWithStreamingResponse, + AsyncAuditResourceWithStreamingResponse, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["LogsResource", "AsyncLogsResource"] + + +class LogsResource(SyncAPIResource): + @cached_property + def audit(self) -> AuditResource: + return AuditResource(self._client) + + @cached_property + def with_raw_response(self) -> LogsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return LogsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LogsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return LogsResourceWithStreamingResponse(self) + + +class AsyncLogsResource(AsyncAPIResource): + @cached_property + def audit(self) -> AsyncAuditResource: + return AsyncAuditResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncLogsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncLogsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLogsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncLogsResourceWithStreamingResponse(self) + + +class LogsResourceWithRawResponse: + def __init__(self, logs: LogsResource) -> None: + self._logs = logs + + @cached_property + def audit(self) -> AuditResourceWithRawResponse: + return AuditResourceWithRawResponse(self._logs.audit) + + +class AsyncLogsResourceWithRawResponse: + def __init__(self, logs: AsyncLogsResource) -> None: + self._logs = logs + + @cached_property + def audit(self) -> AsyncAuditResourceWithRawResponse: + return AsyncAuditResourceWithRawResponse(self._logs.audit) + + +class LogsResourceWithStreamingResponse: + def __init__(self, logs: LogsResource) -> None: + self._logs = logs + + @cached_property + def audit(self) -> AuditResourceWithStreamingResponse: + return AuditResourceWithStreamingResponse(self._logs.audit) + + +class AsyncLogsResourceWithStreamingResponse: + def __init__(self, logs: AsyncLogsResource) -> None: + self._logs = logs + + @cached_property + def audit(self) -> AsyncAuditResourceWithStreamingResponse: + return AsyncAuditResourceWithStreamingResponse(self._logs.audit) diff --git a/src/cloudflare/resources/addressing/address_maps/accounts.py b/src/cloudflare/resources/addressing/address_maps/accounts.py index 38533ca9ce1..a5279ff240c 100644 --- a/src/cloudflare/resources/addressing/address_maps/accounts.py +++ b/src/cloudflare/resources/addressing/address_maps/accounts.py @@ -62,9 +62,9 @@ def update( Add an account as a member of a particular address map. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - address_map_id: Identifier + address_map_id: Identifier of an Address Map. extra_headers: Send extra headers @@ -103,9 +103,9 @@ def delete( Remove an account as a member of a particular address map. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - address_map_id: Identifier + address_map_id: Identifier of an Address Map. extra_headers: Send extra headers @@ -165,9 +165,9 @@ async def update( Add an account as a member of a particular address map. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - address_map_id: Identifier + address_map_id: Identifier of an Address Map. extra_headers: Send extra headers @@ -206,9 +206,9 @@ async def delete( Remove an account as a member of a particular address map. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - address_map_id: Identifier + address_map_id: Identifier of an Address Map. extra_headers: Send extra headers diff --git a/src/cloudflare/resources/addressing/address_maps/address_maps.py b/src/cloudflare/resources/addressing/address_maps/address_maps.py index 34106c3241e..b3a6fda77c9 100644 --- a/src/cloudflare/resources/addressing/address_maps/address_maps.py +++ b/src/cloudflare/resources/addressing/address_maps/address_maps.py @@ -106,7 +106,7 @@ def create( Create a new address map under the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. description: An optional description field which may be used to describe the types of IPs or zones on the map. @@ -163,7 +163,7 @@ def list( List all address maps owned by the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. extra_headers: Send extra headers @@ -202,9 +202,9 @@ def delete( disabled before it can be deleted. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - address_map_id: Identifier + address_map_id: Identifier of an Address Map. extra_headers: Send extra headers @@ -245,9 +245,9 @@ def edit( Modify properties of an address map owned by the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - address_map_id: Identifier + address_map_id: Identifier of an Address Map. default_sni: If you have legacy TLS clients which do not send the TLS server name indicator, then you can specify one default SNI on the map. If Cloudflare receives a TLS @@ -309,9 +309,9 @@ def get( Show a particular address map owned by the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - address_map_id: Identifier + address_map_id: Identifier of an Address Map. extra_headers: Send extra headers @@ -389,7 +389,7 @@ async def create( Create a new address map under the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. description: An optional description field which may be used to describe the types of IPs or zones on the map. @@ -446,7 +446,7 @@ def list( List all address maps owned by the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. extra_headers: Send extra headers @@ -485,9 +485,9 @@ async def delete( disabled before it can be deleted. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - address_map_id: Identifier + address_map_id: Identifier of an Address Map. extra_headers: Send extra headers @@ -528,9 +528,9 @@ async def edit( Modify properties of an address map owned by the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - address_map_id: Identifier + address_map_id: Identifier of an Address Map. default_sni: If you have legacy TLS clients which do not send the TLS server name indicator, then you can specify one default SNI on the map. If Cloudflare receives a TLS @@ -592,9 +592,9 @@ async def get( Show a particular address map owned by the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - address_map_id: Identifier + address_map_id: Identifier of an Address Map. extra_headers: Send extra headers diff --git a/src/cloudflare/resources/addressing/address_maps/ips.py b/src/cloudflare/resources/addressing/address_maps/ips.py index 77e0d36e133..15c999ab654 100644 --- a/src/cloudflare/resources/addressing/address_maps/ips.py +++ b/src/cloudflare/resources/addressing/address_maps/ips.py @@ -63,9 +63,9 @@ def update( Add an IP from a prefix owned by the account to a particular address map. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - address_map_id: Identifier + address_map_id: Identifier of an Address Map. ip_address: An IPv4 or IPv6 address. @@ -109,9 +109,9 @@ def delete( Remove an IP from a particular address map. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - address_map_id: Identifier + address_map_id: Identifier of an Address Map. ip_address: An IPv4 or IPv6 address. @@ -176,9 +176,9 @@ async def update( Add an IP from a prefix owned by the account to a particular address map. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - address_map_id: Identifier + address_map_id: Identifier of an Address Map. ip_address: An IPv4 or IPv6 address. @@ -222,9 +222,9 @@ async def delete( Remove an IP from a particular address map. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - address_map_id: Identifier + address_map_id: Identifier of an Address Map. ip_address: An IPv4 or IPv6 address. diff --git a/src/cloudflare/resources/addressing/address_maps/zones.py b/src/cloudflare/resources/addressing/address_maps/zones.py index f2a68645e31..d7f859f2617 100644 --- a/src/cloudflare/resources/addressing/address_maps/zones.py +++ b/src/cloudflare/resources/addressing/address_maps/zones.py @@ -63,11 +63,11 @@ def update( Add a zone as a member of a particular address map. Args: - zone_id: Identifier + zone_id: Identifier of a zone. - account_id: Identifier + account_id: Identifier of a Cloudflare account. - address_map_id: Identifier + address_map_id: Identifier of an Address Map. extra_headers: Send extra headers @@ -109,11 +109,11 @@ def delete( Remove a zone as a member of a particular address map. Args: - zone_id: Identifier + zone_id: Identifier of a zone. - account_id: Identifier + account_id: Identifier of a Cloudflare account. - address_map_id: Identifier + address_map_id: Identifier of an Address Map. extra_headers: Send extra headers @@ -176,11 +176,11 @@ async def update( Add a zone as a member of a particular address map. Args: - zone_id: Identifier + zone_id: Identifier of a zone. - account_id: Identifier + account_id: Identifier of a Cloudflare account. - address_map_id: Identifier + address_map_id: Identifier of an Address Map. extra_headers: Send extra headers @@ -222,11 +222,11 @@ async def delete( Remove a zone as a member of a particular address map. Args: - zone_id: Identifier + zone_id: Identifier of a zone. - account_id: Identifier + account_id: Identifier of a Cloudflare account. - address_map_id: Identifier + address_map_id: Identifier of an Address Map. extra_headers: Send extra headers diff --git a/src/cloudflare/resources/addressing/addressing.py b/src/cloudflare/resources/addressing/addressing.py index e5ce952404e..65ac3b59c70 100644 --- a/src/cloudflare/resources/addressing/addressing.py +++ b/src/cloudflare/resources/addressing/addressing.py @@ -12,6 +12,14 @@ ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource +from .loa_documents import ( + LOADocumentsResource, + AsyncLOADocumentsResource, + LOADocumentsResourceWithRawResponse, + AsyncLOADocumentsResourceWithRawResponse, + LOADocumentsResourceWithStreamingResponse, + AsyncLOADocumentsResourceWithStreamingResponse, +) from .prefixes.prefixes import ( PrefixesResource, AsyncPrefixesResource, @@ -28,14 +36,6 @@ AddressMapsResourceWithStreamingResponse, AsyncAddressMapsResourceWithStreamingResponse, ) -from .loa_documents.loa_documents import ( - LOADocumentsResource, - AsyncLOADocumentsResource, - LOADocumentsResourceWithRawResponse, - AsyncLOADocumentsResourceWithRawResponse, - LOADocumentsResourceWithStreamingResponse, - AsyncLOADocumentsResourceWithStreamingResponse, -) from .regional_hostnames.regional_hostnames import ( RegionalHostnamesResource, AsyncRegionalHostnamesResource, diff --git a/src/cloudflare/resources/addressing/loa_documents/loa_documents.py b/src/cloudflare/resources/addressing/loa_documents.py similarity index 60% rename from src/cloudflare/resources/addressing/loa_documents/loa_documents.py rename to src/cloudflare/resources/addressing/loa_documents.py index 8e2b78160fa..c4db454b8c2 100644 --- a/src/cloudflare/resources/addressing/loa_documents/loa_documents.py +++ b/src/cloudflare/resources/addressing/loa_documents.py @@ -6,40 +6,36 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import ( maybe_transform, async_maybe_transform, ) -from .downloads import ( - DownloadsResource, - AsyncDownloadsResource, - DownloadsResourceWithRawResponse, - AsyncDownloadsResourceWithRawResponse, - DownloadsResourceWithStreamingResponse, - AsyncDownloadsResourceWithStreamingResponse, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + BinaryAPIResponse, + AsyncBinaryAPIResponse, + StreamedBinaryAPIResponse, + AsyncStreamedBinaryAPIResponse, to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, + to_custom_raw_response_wrapper, async_to_streamed_response_wrapper, + to_custom_streamed_response_wrapper, + async_to_custom_raw_response_wrapper, + async_to_custom_streamed_response_wrapper, ) -from ...._wrappers import ResultWrapper -from ...._base_client import make_request_options -from ....types.addressing import loa_document_create_params -from ....types.addressing.loa_document_create_response import LOADocumentCreateResponse +from ..._wrappers import ResultWrapper +from ..._base_client import make_request_options +from ...types.addressing import loa_document_create_params +from ...types.addressing.loa_document_create_response import LOADocumentCreateResponse __all__ = ["LOADocumentsResource", "AsyncLOADocumentsResource"] class LOADocumentsResource(SyncAPIResource): - @cached_property - def downloads(self) -> DownloadsResource: - return DownloadsResource(self._client) - @cached_property def with_raw_response(self) -> LOADocumentsResourceWithRawResponse: """ @@ -75,7 +71,7 @@ def create( Submit LOA document (pdf format) under the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. loa_document: LOA document to upload. @@ -106,12 +102,49 @@ def create( cast_to=cast(Type[Optional[LOADocumentCreateResponse]], ResultWrapper[LOADocumentCreateResponse]), ) + def get( + self, + loa_document_id: Optional[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, + ) -> BinaryAPIResponse: + """ + Download specified LOA document under the account. -class AsyncLOADocumentsResource(AsyncAPIResource): - @cached_property - def downloads(self) -> AsyncDownloadsResource: - return AsyncDownloadsResource(self._client) + Args: + account_id: Identifier of a Cloudflare account. + + loa_document_id: Identifier for the uploaded LOA document. + + 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 loa_document_id: + raise ValueError(f"Expected a non-empty value for `loa_document_id` but received {loa_document_id!r}") + extra_headers = {"Accept": "application/pdf", **(extra_headers or {})} + return self._get( + f"/accounts/{account_id}/addressing/loa_documents/{loa_document_id}/download", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BinaryAPIResponse, + ) + + +class AsyncLOADocumentsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncLOADocumentsResourceWithRawResponse: """ @@ -147,7 +180,7 @@ async def create( Submit LOA document (pdf format) under the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. loa_document: LOA document to upload. @@ -180,6 +213,47 @@ async def create( cast_to=cast(Type[Optional[LOADocumentCreateResponse]], ResultWrapper[LOADocumentCreateResponse]), ) + async def get( + self, + loa_document_id: Optional[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, + ) -> AsyncBinaryAPIResponse: + """ + Download specified LOA document under the account. + + Args: + account_id: Identifier of a Cloudflare account. + + loa_document_id: Identifier for the uploaded LOA document. + + 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 loa_document_id: + raise ValueError(f"Expected a non-empty value for `loa_document_id` but received {loa_document_id!r}") + extra_headers = {"Accept": "application/pdf", **(extra_headers or {})} + return await self._get( + f"/accounts/{account_id}/addressing/loa_documents/{loa_document_id}/download", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AsyncBinaryAPIResponse, + ) + class LOADocumentsResourceWithRawResponse: def __init__(self, loa_documents: LOADocumentsResource) -> None: @@ -188,10 +262,10 @@ def __init__(self, loa_documents: LOADocumentsResource) -> None: self.create = to_raw_response_wrapper( loa_documents.create, ) - - @cached_property - def downloads(self) -> DownloadsResourceWithRawResponse: - return DownloadsResourceWithRawResponse(self._loa_documents.downloads) + self.get = to_custom_raw_response_wrapper( + loa_documents.get, + BinaryAPIResponse, + ) class AsyncLOADocumentsResourceWithRawResponse: @@ -201,10 +275,10 @@ def __init__(self, loa_documents: AsyncLOADocumentsResource) -> None: self.create = async_to_raw_response_wrapper( loa_documents.create, ) - - @cached_property - def downloads(self) -> AsyncDownloadsResourceWithRawResponse: - return AsyncDownloadsResourceWithRawResponse(self._loa_documents.downloads) + self.get = async_to_custom_raw_response_wrapper( + loa_documents.get, + AsyncBinaryAPIResponse, + ) class LOADocumentsResourceWithStreamingResponse: @@ -214,10 +288,10 @@ def __init__(self, loa_documents: LOADocumentsResource) -> None: self.create = to_streamed_response_wrapper( loa_documents.create, ) - - @cached_property - def downloads(self) -> DownloadsResourceWithStreamingResponse: - return DownloadsResourceWithStreamingResponse(self._loa_documents.downloads) + self.get = to_custom_streamed_response_wrapper( + loa_documents.get, + StreamedBinaryAPIResponse, + ) class AsyncLOADocumentsResourceWithStreamingResponse: @@ -227,7 +301,7 @@ def __init__(self, loa_documents: AsyncLOADocumentsResource) -> None: self.create = async_to_streamed_response_wrapper( loa_documents.create, ) - - @cached_property - def downloads(self) -> AsyncDownloadsResourceWithStreamingResponse: - return AsyncDownloadsResourceWithStreamingResponse(self._loa_documents.downloads) + self.get = async_to_custom_streamed_response_wrapper( + loa_documents.get, + AsyncStreamedBinaryAPIResponse, + ) diff --git a/src/cloudflare/resources/addressing/loa_documents/__init__.py b/src/cloudflare/resources/addressing/loa_documents/__init__.py deleted file mode 100644 index 72f6dbba90c..00000000000 --- a/src/cloudflare/resources/addressing/loa_documents/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .downloads import ( - DownloadsResource, - AsyncDownloadsResource, - DownloadsResourceWithRawResponse, - AsyncDownloadsResourceWithRawResponse, - DownloadsResourceWithStreamingResponse, - AsyncDownloadsResourceWithStreamingResponse, -) -from .loa_documents import ( - LOADocumentsResource, - AsyncLOADocumentsResource, - LOADocumentsResourceWithRawResponse, - AsyncLOADocumentsResourceWithRawResponse, - LOADocumentsResourceWithStreamingResponse, - AsyncLOADocumentsResourceWithStreamingResponse, -) - -__all__ = [ - "DownloadsResource", - "AsyncDownloadsResource", - "DownloadsResourceWithRawResponse", - "AsyncDownloadsResourceWithRawResponse", - "DownloadsResourceWithStreamingResponse", - "AsyncDownloadsResourceWithStreamingResponse", - "LOADocumentsResource", - "AsyncLOADocumentsResource", - "LOADocumentsResourceWithRawResponse", - "AsyncLOADocumentsResourceWithRawResponse", - "LOADocumentsResourceWithStreamingResponse", - "AsyncLOADocumentsResourceWithStreamingResponse", -] diff --git a/src/cloudflare/resources/addressing/loa_documents/downloads.py b/src/cloudflare/resources/addressing/loa_documents/downloads.py deleted file mode 100644 index 9c21fa752b2..00000000000 --- a/src/cloudflare/resources/addressing/loa_documents/downloads.py +++ /dev/null @@ -1,188 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - BinaryAPIResponse, - AsyncBinaryAPIResponse, - StreamedBinaryAPIResponse, - AsyncStreamedBinaryAPIResponse, - to_custom_raw_response_wrapper, - to_custom_streamed_response_wrapper, - async_to_custom_raw_response_wrapper, - async_to_custom_streamed_response_wrapper, -) -from ...._base_client import make_request_options - -__all__ = ["DownloadsResource", "AsyncDownloadsResource"] - - -class DownloadsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> DownloadsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers - """ - return DownloadsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> DownloadsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response - """ - return DownloadsResourceWithStreamingResponse(self) - - def get( - self, - loa_document_id: Optional[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, - ) -> BinaryAPIResponse: - """ - Download specified LOA document under the account. - - Args: - account_id: Identifier - - loa_document_id: Identifier for the uploaded LOA document. - - 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 loa_document_id: - raise ValueError(f"Expected a non-empty value for `loa_document_id` but received {loa_document_id!r}") - extra_headers = {"Accept": "application/pdf", **(extra_headers or {})} - return self._get( - f"/accounts/{account_id}/addressing/loa_documents/{loa_document_id}/download", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=BinaryAPIResponse, - ) - - -class AsyncDownloadsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncDownloadsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers - """ - return AsyncDownloadsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncDownloadsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response - """ - return AsyncDownloadsResourceWithStreamingResponse(self) - - async def get( - self, - loa_document_id: Optional[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, - ) -> AsyncBinaryAPIResponse: - """ - Download specified LOA document under the account. - - Args: - account_id: Identifier - - loa_document_id: Identifier for the uploaded LOA document. - - 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 loa_document_id: - raise ValueError(f"Expected a non-empty value for `loa_document_id` but received {loa_document_id!r}") - extra_headers = {"Accept": "application/pdf", **(extra_headers or {})} - return await self._get( - f"/accounts/{account_id}/addressing/loa_documents/{loa_document_id}/download", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AsyncBinaryAPIResponse, - ) - - -class DownloadsResourceWithRawResponse: - def __init__(self, downloads: DownloadsResource) -> None: - self._downloads = downloads - - self.get = to_custom_raw_response_wrapper( - downloads.get, - BinaryAPIResponse, - ) - - -class AsyncDownloadsResourceWithRawResponse: - def __init__(self, downloads: AsyncDownloadsResource) -> None: - self._downloads = downloads - - self.get = async_to_custom_raw_response_wrapper( - downloads.get, - AsyncBinaryAPIResponse, - ) - - -class DownloadsResourceWithStreamingResponse: - def __init__(self, downloads: DownloadsResource) -> None: - self._downloads = downloads - - self.get = to_custom_streamed_response_wrapper( - downloads.get, - StreamedBinaryAPIResponse, - ) - - -class AsyncDownloadsResourceWithStreamingResponse: - def __init__(self, downloads: AsyncDownloadsResource) -> None: - self._downloads = downloads - - self.get = async_to_custom_streamed_response_wrapper( - downloads.get, - AsyncStreamedBinaryAPIResponse, - ) diff --git a/src/cloudflare/resources/addressing/prefixes/__init__.py b/src/cloudflare/resources/addressing/prefixes/__init__.py index baf5dcefd16..89ce6e1fa39 100644 --- a/src/cloudflare/resources/addressing/prefixes/__init__.py +++ b/src/cloudflare/resources/addressing/prefixes/__init__.py @@ -1,13 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .bgp import ( - BGPResource, - AsyncBGPResource, - BGPResourceWithRawResponse, - AsyncBGPResourceWithRawResponse, - BGPResourceWithStreamingResponse, - AsyncBGPResourceWithStreamingResponse, -) from .prefixes import ( PrefixesResource, AsyncPrefixesResource, @@ -24,14 +16,50 @@ DelegationsResourceWithStreamingResponse, AsyncDelegationsResourceWithStreamingResponse, ) +from .bgp_prefixes import ( + BGPPrefixesResource, + AsyncBGPPrefixesResource, + BGPPrefixesResourceWithRawResponse, + AsyncBGPPrefixesResourceWithRawResponse, + BGPPrefixesResourceWithStreamingResponse, + AsyncBGPPrefixesResourceWithStreamingResponse, +) +from .service_bindings import ( + ServiceBindingsResource, + AsyncServiceBindingsResource, + ServiceBindingsResourceWithRawResponse, + AsyncServiceBindingsResourceWithRawResponse, + ServiceBindingsResourceWithStreamingResponse, + AsyncServiceBindingsResourceWithStreamingResponse, +) +from .advertisement_status import ( + AdvertisementStatusResource, + AsyncAdvertisementStatusResource, + AdvertisementStatusResourceWithRawResponse, + AsyncAdvertisementStatusResourceWithRawResponse, + AdvertisementStatusResourceWithStreamingResponse, + AsyncAdvertisementStatusResourceWithStreamingResponse, +) __all__ = [ - "BGPResource", - "AsyncBGPResource", - "BGPResourceWithRawResponse", - "AsyncBGPResourceWithRawResponse", - "BGPResourceWithStreamingResponse", - "AsyncBGPResourceWithStreamingResponse", + "ServiceBindingsResource", + "AsyncServiceBindingsResource", + "ServiceBindingsResourceWithRawResponse", + "AsyncServiceBindingsResourceWithRawResponse", + "ServiceBindingsResourceWithStreamingResponse", + "AsyncServiceBindingsResourceWithStreamingResponse", + "BGPPrefixesResource", + "AsyncBGPPrefixesResource", + "BGPPrefixesResourceWithRawResponse", + "AsyncBGPPrefixesResourceWithRawResponse", + "BGPPrefixesResourceWithStreamingResponse", + "AsyncBGPPrefixesResourceWithStreamingResponse", + "AdvertisementStatusResource", + "AsyncAdvertisementStatusResource", + "AdvertisementStatusResourceWithRawResponse", + "AsyncAdvertisementStatusResourceWithRawResponse", + "AdvertisementStatusResourceWithStreamingResponse", + "AsyncAdvertisementStatusResourceWithStreamingResponse", "DelegationsResource", "AsyncDelegationsResource", "DelegationsResourceWithRawResponse", diff --git a/src/cloudflare/resources/addressing/prefixes/advertisement_status.py b/src/cloudflare/resources/addressing/prefixes/advertisement_status.py new file mode 100644 index 00000000000..4ca0b677f15 --- /dev/null +++ b/src/cloudflare/resources/addressing/prefixes/advertisement_status.py @@ -0,0 +1,324 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Type, Optional, cast + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import ( + maybe_transform, + async_maybe_transform, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._wrappers import ResultWrapper +from ...._base_client import make_request_options +from ....types.addressing.prefixes import advertisement_status_edit_params +from ....types.addressing.prefixes.advertisement_status_get_response import AdvertisementStatusGetResponse +from ....types.addressing.prefixes.advertisement_status_edit_response import AdvertisementStatusEditResponse + +__all__ = ["AdvertisementStatusResource", "AsyncAdvertisementStatusResource"] + + +class AdvertisementStatusResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AdvertisementStatusResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AdvertisementStatusResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AdvertisementStatusResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AdvertisementStatusResourceWithStreamingResponse(self) + + def edit( + self, + prefix_id: str, + *, + account_id: str, + advertised: bool, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[AdvertisementStatusEditResponse]: + """ + Advertise or withdraw the BGP route for a prefix. + + **Deprecated:** Prefer the BGP Prefixes endpoints, which additionally allow for + advertising and withdrawing subnets of an IP prefix. + + Args: + account_id: Identifier of a Cloudflare account. + + prefix_id: Identifier of an IP Prefix. + + advertised: Advertisement status of the prefix. If `true`, the BGP route for the prefix is + advertised to the Internet. If `false`, the BGP route is withdrawn. + + 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 prefix_id: + raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") + return self._patch( + f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/status", + body=maybe_transform( + {"advertised": advertised}, advertisement_status_edit_params.AdvertisementStatusEditParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AdvertisementStatusEditResponse]]._unwrapper, + ), + cast_to=cast( + Type[Optional[AdvertisementStatusEditResponse]], ResultWrapper[AdvertisementStatusEditResponse] + ), + ) + + def get( + self, + prefix_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[AdvertisementStatusGetResponse]: + """ + View the current advertisement state for a prefix. + + **Deprecated:** Prefer the BGP Prefixes endpoints, which additionally allow for + advertising and withdrawing subnets of an IP prefix. + + Args: + account_id: Identifier of a Cloudflare account. + + prefix_id: Identifier of an IP Prefix. + + 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 prefix_id: + raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") + return self._get( + f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/status", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AdvertisementStatusGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[AdvertisementStatusGetResponse]], ResultWrapper[AdvertisementStatusGetResponse]), + ) + + +class AsyncAdvertisementStatusResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAdvertisementStatusResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncAdvertisementStatusResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAdvertisementStatusResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncAdvertisementStatusResourceWithStreamingResponse(self) + + async def edit( + self, + prefix_id: str, + *, + account_id: str, + advertised: bool, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[AdvertisementStatusEditResponse]: + """ + Advertise or withdraw the BGP route for a prefix. + + **Deprecated:** Prefer the BGP Prefixes endpoints, which additionally allow for + advertising and withdrawing subnets of an IP prefix. + + Args: + account_id: Identifier of a Cloudflare account. + + prefix_id: Identifier of an IP Prefix. + + advertised: Advertisement status of the prefix. If `true`, the BGP route for the prefix is + advertised to the Internet. If `false`, the BGP route is withdrawn. + + 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 prefix_id: + raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") + return await self._patch( + f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/status", + body=await async_maybe_transform( + {"advertised": advertised}, advertisement_status_edit_params.AdvertisementStatusEditParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AdvertisementStatusEditResponse]]._unwrapper, + ), + cast_to=cast( + Type[Optional[AdvertisementStatusEditResponse]], ResultWrapper[AdvertisementStatusEditResponse] + ), + ) + + async def get( + self, + prefix_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[AdvertisementStatusGetResponse]: + """ + View the current advertisement state for a prefix. + + **Deprecated:** Prefer the BGP Prefixes endpoints, which additionally allow for + advertising and withdrawing subnets of an IP prefix. + + Args: + account_id: Identifier of a Cloudflare account. + + prefix_id: Identifier of an IP Prefix. + + 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 prefix_id: + raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") + return await self._get( + f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/status", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AdvertisementStatusGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[AdvertisementStatusGetResponse]], ResultWrapper[AdvertisementStatusGetResponse]), + ) + + +class AdvertisementStatusResourceWithRawResponse: + def __init__(self, advertisement_status: AdvertisementStatusResource) -> None: + self._advertisement_status = advertisement_status + + self.edit = to_raw_response_wrapper( + advertisement_status.edit, + ) + self.get = to_raw_response_wrapper( + advertisement_status.get, + ) + + +class AsyncAdvertisementStatusResourceWithRawResponse: + def __init__(self, advertisement_status: AsyncAdvertisementStatusResource) -> None: + self._advertisement_status = advertisement_status + + self.edit = async_to_raw_response_wrapper( + advertisement_status.edit, + ) + self.get = async_to_raw_response_wrapper( + advertisement_status.get, + ) + + +class AdvertisementStatusResourceWithStreamingResponse: + def __init__(self, advertisement_status: AdvertisementStatusResource) -> None: + self._advertisement_status = advertisement_status + + self.edit = to_streamed_response_wrapper( + advertisement_status.edit, + ) + self.get = to_streamed_response_wrapper( + advertisement_status.get, + ) + + +class AsyncAdvertisementStatusResourceWithStreamingResponse: + def __init__(self, advertisement_status: AsyncAdvertisementStatusResource) -> None: + self._advertisement_status = advertisement_status + + self.edit = async_to_streamed_response_wrapper( + advertisement_status.edit, + ) + self.get = async_to_streamed_response_wrapper( + advertisement_status.get, + ) diff --git a/src/cloudflare/resources/addressing/prefixes/bgp/__init__.py b/src/cloudflare/resources/addressing/prefixes/bgp/__init__.py deleted file mode 100644 index 8c3709d72cc..00000000000 --- a/src/cloudflare/resources/addressing/prefixes/bgp/__init__.py +++ /dev/null @@ -1,61 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .bgp import ( - BGPResource, - AsyncBGPResource, - BGPResourceWithRawResponse, - AsyncBGPResourceWithRawResponse, - BGPResourceWithStreamingResponse, - AsyncBGPResourceWithStreamingResponse, -) -from .bindings import ( - BindingsResource, - AsyncBindingsResource, - BindingsResourceWithRawResponse, - AsyncBindingsResourceWithRawResponse, - BindingsResourceWithStreamingResponse, - AsyncBindingsResourceWithStreamingResponse, -) -from .prefixes import ( - PrefixesResource, - AsyncPrefixesResource, - PrefixesResourceWithRawResponse, - AsyncPrefixesResourceWithRawResponse, - PrefixesResourceWithStreamingResponse, - AsyncPrefixesResourceWithStreamingResponse, -) -from .statuses import ( - StatusesResource, - AsyncStatusesResource, - StatusesResourceWithRawResponse, - AsyncStatusesResourceWithRawResponse, - StatusesResourceWithStreamingResponse, - AsyncStatusesResourceWithStreamingResponse, -) - -__all__ = [ - "BindingsResource", - "AsyncBindingsResource", - "BindingsResourceWithRawResponse", - "AsyncBindingsResourceWithRawResponse", - "BindingsResourceWithStreamingResponse", - "AsyncBindingsResourceWithStreamingResponse", - "PrefixesResource", - "AsyncPrefixesResource", - "PrefixesResourceWithRawResponse", - "AsyncPrefixesResourceWithRawResponse", - "PrefixesResourceWithStreamingResponse", - "AsyncPrefixesResourceWithStreamingResponse", - "StatusesResource", - "AsyncStatusesResource", - "StatusesResourceWithRawResponse", - "AsyncStatusesResourceWithRawResponse", - "StatusesResourceWithStreamingResponse", - "AsyncStatusesResourceWithStreamingResponse", - "BGPResource", - "AsyncBGPResource", - "BGPResourceWithRawResponse", - "AsyncBGPResourceWithRawResponse", - "BGPResourceWithStreamingResponse", - "AsyncBGPResourceWithStreamingResponse", -] diff --git a/src/cloudflare/resources/addressing/prefixes/bgp/bgp.py b/src/cloudflare/resources/addressing/prefixes/bgp/bgp.py deleted file mode 100644 index 0aaf8300bf8..00000000000 --- a/src/cloudflare/resources/addressing/prefixes/bgp/bgp.py +++ /dev/null @@ -1,166 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .bindings import ( - BindingsResource, - AsyncBindingsResource, - BindingsResourceWithRawResponse, - AsyncBindingsResourceWithRawResponse, - BindingsResourceWithStreamingResponse, - AsyncBindingsResourceWithStreamingResponse, -) -from .prefixes import ( - PrefixesResource, - AsyncPrefixesResource, - PrefixesResourceWithRawResponse, - AsyncPrefixesResourceWithRawResponse, - PrefixesResourceWithStreamingResponse, - AsyncPrefixesResourceWithStreamingResponse, -) -from .statuses import ( - StatusesResource, - AsyncStatusesResource, - StatusesResourceWithRawResponse, - AsyncStatusesResourceWithRawResponse, - StatusesResourceWithStreamingResponse, - AsyncStatusesResourceWithStreamingResponse, -) -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource - -__all__ = ["BGPResource", "AsyncBGPResource"] - - -class BGPResource(SyncAPIResource): - @cached_property - def bindings(self) -> BindingsResource: - return BindingsResource(self._client) - - @cached_property - def prefixes(self) -> PrefixesResource: - return PrefixesResource(self._client) - - @cached_property - def statuses(self) -> StatusesResource: - return StatusesResource(self._client) - - @cached_property - def with_raw_response(self) -> BGPResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers - """ - return BGPResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> BGPResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response - """ - return BGPResourceWithStreamingResponse(self) - - -class AsyncBGPResource(AsyncAPIResource): - @cached_property - def bindings(self) -> AsyncBindingsResource: - return AsyncBindingsResource(self._client) - - @cached_property - def prefixes(self) -> AsyncPrefixesResource: - return AsyncPrefixesResource(self._client) - - @cached_property - def statuses(self) -> AsyncStatusesResource: - return AsyncStatusesResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncBGPResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers - """ - return AsyncBGPResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncBGPResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response - """ - return AsyncBGPResourceWithStreamingResponse(self) - - -class BGPResourceWithRawResponse: - def __init__(self, bgp: BGPResource) -> None: - self._bgp = bgp - - @cached_property - def bindings(self) -> BindingsResourceWithRawResponse: - return BindingsResourceWithRawResponse(self._bgp.bindings) - - @cached_property - def prefixes(self) -> PrefixesResourceWithRawResponse: - return PrefixesResourceWithRawResponse(self._bgp.prefixes) - - @cached_property - def statuses(self) -> StatusesResourceWithRawResponse: - return StatusesResourceWithRawResponse(self._bgp.statuses) - - -class AsyncBGPResourceWithRawResponse: - def __init__(self, bgp: AsyncBGPResource) -> None: - self._bgp = bgp - - @cached_property - def bindings(self) -> AsyncBindingsResourceWithRawResponse: - return AsyncBindingsResourceWithRawResponse(self._bgp.bindings) - - @cached_property - def prefixes(self) -> AsyncPrefixesResourceWithRawResponse: - return AsyncPrefixesResourceWithRawResponse(self._bgp.prefixes) - - @cached_property - def statuses(self) -> AsyncStatusesResourceWithRawResponse: - return AsyncStatusesResourceWithRawResponse(self._bgp.statuses) - - -class BGPResourceWithStreamingResponse: - def __init__(self, bgp: BGPResource) -> None: - self._bgp = bgp - - @cached_property - def bindings(self) -> BindingsResourceWithStreamingResponse: - return BindingsResourceWithStreamingResponse(self._bgp.bindings) - - @cached_property - def prefixes(self) -> PrefixesResourceWithStreamingResponse: - return PrefixesResourceWithStreamingResponse(self._bgp.prefixes) - - @cached_property - def statuses(self) -> StatusesResourceWithStreamingResponse: - return StatusesResourceWithStreamingResponse(self._bgp.statuses) - - -class AsyncBGPResourceWithStreamingResponse: - def __init__(self, bgp: AsyncBGPResource) -> None: - self._bgp = bgp - - @cached_property - def bindings(self) -> AsyncBindingsResourceWithStreamingResponse: - return AsyncBindingsResourceWithStreamingResponse(self._bgp.bindings) - - @cached_property - def prefixes(self) -> AsyncPrefixesResourceWithStreamingResponse: - return AsyncPrefixesResourceWithStreamingResponse(self._bgp.prefixes) - - @cached_property - def statuses(self) -> AsyncStatusesResourceWithStreamingResponse: - return AsyncStatusesResourceWithStreamingResponse(self._bgp.statuses) diff --git a/src/cloudflare/resources/addressing/prefixes/bgp/prefixes.py b/src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py similarity index 62% rename from src/cloudflare/resources/addressing/prefixes/bgp/prefixes.py rename to src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py index c99139e7d70..3f65acd83ad 100644 --- a/src/cloudflare/resources/addressing/prefixes/bgp/prefixes.py +++ b/src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py @@ -6,47 +6,97 @@ import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._utils import ( +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 ( +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....._wrappers import ResultWrapper -from .....pagination import SyncSinglePage, AsyncSinglePage -from ....._base_client import AsyncPaginator, make_request_options -from .....types.addressing.prefixes.bgp import prefix_edit_params -from .....types.addressing.prefixes.bgp.bgp_prefix import BGPPrefix +from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage +from ...._base_client import AsyncPaginator, make_request_options +from ....types.addressing.prefixes import bgp_prefix_edit_params, bgp_prefix_create_params +from ....types.addressing.prefixes.bgp_prefix import BGPPrefix -__all__ = ["PrefixesResource", "AsyncPrefixesResource"] +__all__ = ["BGPPrefixesResource", "AsyncBGPPrefixesResource"] -class PrefixesResource(SyncAPIResource): +class BGPPrefixesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PrefixesResourceWithRawResponse: + def with_raw_response(self) -> BGPPrefixesResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers """ - return PrefixesResourceWithRawResponse(self) + return BGPPrefixesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PrefixesResourceWithStreamingResponse: + def with_streaming_response(self) -> BGPPrefixesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response """ - return PrefixesResourceWithStreamingResponse(self) + return BGPPrefixesResourceWithStreamingResponse(self) + + def create( + self, + prefix_id: str, + *, + account_id: str, + cidr: 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, + ) -> Optional[BGPPrefix]: + """ + Create a BGP prefix, controlling the BGP advertisement status of a specific + subnet. When created, BGP prefixes are initially withdrawn, and can be + advertised with the Update BGP Prefix API. + + Args: + account_id: Identifier of a Cloudflare account. + + prefix_id: Identifier of an IP Prefix. + + cidr: IP Prefix in Classless Inter-Domain Routing format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not prefix_id: + raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") + return self._post( + f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes", + body=maybe_transform({"cidr": cidr}, bgp_prefix_create_params.BGPPrefixCreateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[BGPPrefix]]._unwrapper, + ), + cast_to=cast(Type[Optional[BGPPrefix]], ResultWrapper[BGPPrefix]), + ) def list( self, @@ -68,9 +118,9 @@ def list( Prefixes. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. extra_headers: Send extra headers @@ -99,7 +149,7 @@ def edit( *, account_id: str, prefix_id: str, - on_demand: prefix_edit_params.OnDemand | NotGiven = NOT_GIVEN, + on_demand: bgp_prefix_edit_params.OnDemand | 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, @@ -112,11 +162,11 @@ def edit( status (advertised or withdrawn). Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. - bgp_prefix_id: Identifier + bgp_prefix_id: Identifier of BGP Prefix. extra_headers: Send extra headers @@ -134,7 +184,7 @@ def edit( raise ValueError(f"Expected a non-empty value for `bgp_prefix_id` but received {bgp_prefix_id!r}") return self._patch( f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes/{bgp_prefix_id}", - body=maybe_transform({"on_demand": on_demand}, prefix_edit_params.PrefixEditParams), + body=maybe_transform({"on_demand": on_demand}, bgp_prefix_edit_params.BGPPrefixEditParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -162,11 +212,11 @@ def get( Retrieve a single BGP Prefix according to its identifier Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. - bgp_prefix_id: Identifier + bgp_prefix_id: Identifier of BGP Prefix. extra_headers: Send extra headers @@ -195,25 +245,75 @@ def get( ) -class AsyncPrefixesResource(AsyncAPIResource): +class AsyncBGPPrefixesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPrefixesResourceWithRawResponse: + def with_raw_response(self) -> AsyncBGPPrefixesResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers """ - return AsyncPrefixesResourceWithRawResponse(self) + return AsyncBGPPrefixesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPrefixesResourceWithStreamingResponse: + def with_streaming_response(self) -> AsyncBGPPrefixesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response """ - return AsyncPrefixesResourceWithStreamingResponse(self) + return AsyncBGPPrefixesResourceWithStreamingResponse(self) + + async def create( + self, + prefix_id: str, + *, + account_id: str, + cidr: 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, + ) -> Optional[BGPPrefix]: + """ + Create a BGP prefix, controlling the BGP advertisement status of a specific + subnet. When created, BGP prefixes are initially withdrawn, and can be + advertised with the Update BGP Prefix API. + + Args: + account_id: Identifier of a Cloudflare account. + + prefix_id: Identifier of an IP Prefix. + + cidr: IP Prefix in Classless Inter-Domain Routing format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not prefix_id: + raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") + return await self._post( + f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes", + body=await async_maybe_transform({"cidr": cidr}, bgp_prefix_create_params.BGPPrefixCreateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[BGPPrefix]]._unwrapper, + ), + cast_to=cast(Type[Optional[BGPPrefix]], ResultWrapper[BGPPrefix]), + ) def list( self, @@ -235,9 +335,9 @@ def list( Prefixes. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. extra_headers: Send extra headers @@ -266,7 +366,7 @@ async def edit( *, account_id: str, prefix_id: str, - on_demand: prefix_edit_params.OnDemand | NotGiven = NOT_GIVEN, + on_demand: bgp_prefix_edit_params.OnDemand | 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, @@ -279,11 +379,11 @@ async def edit( status (advertised or withdrawn). Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. - bgp_prefix_id: Identifier + bgp_prefix_id: Identifier of BGP Prefix. extra_headers: Send extra headers @@ -301,7 +401,7 @@ async def edit( raise ValueError(f"Expected a non-empty value for `bgp_prefix_id` but received {bgp_prefix_id!r}") return await self._patch( f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes/{bgp_prefix_id}", - body=await async_maybe_transform({"on_demand": on_demand}, prefix_edit_params.PrefixEditParams), + body=await async_maybe_transform({"on_demand": on_demand}, bgp_prefix_edit_params.BGPPrefixEditParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -329,11 +429,11 @@ async def get( Retrieve a single BGP Prefix according to its identifier Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. - bgp_prefix_id: Identifier + bgp_prefix_id: Identifier of BGP Prefix. extra_headers: Send extra headers @@ -362,61 +462,73 @@ async def get( ) -class PrefixesResourceWithRawResponse: - def __init__(self, prefixes: PrefixesResource) -> None: - self._prefixes = prefixes +class BGPPrefixesResourceWithRawResponse: + def __init__(self, bgp_prefixes: BGPPrefixesResource) -> None: + self._bgp_prefixes = bgp_prefixes + self.create = to_raw_response_wrapper( + bgp_prefixes.create, + ) self.list = to_raw_response_wrapper( - prefixes.list, + bgp_prefixes.list, ) self.edit = to_raw_response_wrapper( - prefixes.edit, + bgp_prefixes.edit, ) self.get = to_raw_response_wrapper( - prefixes.get, + bgp_prefixes.get, ) -class AsyncPrefixesResourceWithRawResponse: - def __init__(self, prefixes: AsyncPrefixesResource) -> None: - self._prefixes = prefixes +class AsyncBGPPrefixesResourceWithRawResponse: + def __init__(self, bgp_prefixes: AsyncBGPPrefixesResource) -> None: + self._bgp_prefixes = bgp_prefixes + self.create = async_to_raw_response_wrapper( + bgp_prefixes.create, + ) self.list = async_to_raw_response_wrapper( - prefixes.list, + bgp_prefixes.list, ) self.edit = async_to_raw_response_wrapper( - prefixes.edit, + bgp_prefixes.edit, ) self.get = async_to_raw_response_wrapper( - prefixes.get, + bgp_prefixes.get, ) -class PrefixesResourceWithStreamingResponse: - def __init__(self, prefixes: PrefixesResource) -> None: - self._prefixes = prefixes +class BGPPrefixesResourceWithStreamingResponse: + def __init__(self, bgp_prefixes: BGPPrefixesResource) -> None: + self._bgp_prefixes = bgp_prefixes + self.create = to_streamed_response_wrapper( + bgp_prefixes.create, + ) self.list = to_streamed_response_wrapper( - prefixes.list, + bgp_prefixes.list, ) self.edit = to_streamed_response_wrapper( - prefixes.edit, + bgp_prefixes.edit, ) self.get = to_streamed_response_wrapper( - prefixes.get, + bgp_prefixes.get, ) -class AsyncPrefixesResourceWithStreamingResponse: - def __init__(self, prefixes: AsyncPrefixesResource) -> None: - self._prefixes = prefixes +class AsyncBGPPrefixesResourceWithStreamingResponse: + def __init__(self, bgp_prefixes: AsyncBGPPrefixesResource) -> None: + self._bgp_prefixes = bgp_prefixes + self.create = async_to_streamed_response_wrapper( + bgp_prefixes.create, + ) self.list = async_to_streamed_response_wrapper( - prefixes.list, + bgp_prefixes.list, ) self.edit = async_to_streamed_response_wrapper( - prefixes.edit, + bgp_prefixes.edit, ) self.get = async_to_streamed_response_wrapper( - prefixes.get, + bgp_prefixes.get, ) diff --git a/src/cloudflare/resources/addressing/prefixes/delegations.py b/src/cloudflare/resources/addressing/prefixes/delegations.py index b35f31a2893..93870db9319 100644 --- a/src/cloudflare/resources/addressing/prefixes/delegations.py +++ b/src/cloudflare/resources/addressing/prefixes/delegations.py @@ -67,9 +67,9 @@ def create( Create a new account delegation for a given IP prefix. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. cidr: IP Prefix in Classless Inter-Domain Routing format. @@ -122,9 +122,9 @@ def list( List all delegations for a given account IP prefix. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. extra_headers: Send extra headers @@ -164,11 +164,11 @@ def delete( Delete an account delegation for a given IP prefix. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. - delegation_id: Delegation identifier tag. + delegation_id: Identifier of a Delegation. extra_headers: Send extra headers @@ -235,9 +235,9 @@ async def create( Create a new account delegation for a given IP prefix. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. cidr: IP Prefix in Classless Inter-Domain Routing format. @@ -290,9 +290,9 @@ def list( List all delegations for a given account IP prefix. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. extra_headers: Send extra headers @@ -332,11 +332,11 @@ async def delete( Delete an account delegation for a given IP prefix. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. - delegation_id: Delegation identifier tag. + delegation_id: Identifier of a Delegation. extra_headers: Send extra headers diff --git a/src/cloudflare/resources/addressing/prefixes/prefixes.py b/src/cloudflare/resources/addressing/prefixes/prefixes.py index f22011802f1..b9620460953 100644 --- a/src/cloudflare/resources/addressing/prefixes/prefixes.py +++ b/src/cloudflare/resources/addressing/prefixes/prefixes.py @@ -6,14 +6,6 @@ import httpx -from .bgp.bgp import ( - BGPResource, - AsyncBGPResource, - BGPResourceWithRawResponse, - AsyncBGPResourceWithRawResponse, - BGPResourceWithStreamingResponse, - AsyncBGPResourceWithStreamingResponse, -) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( maybe_transform, @@ -36,9 +28,33 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from .bgp_prefixes import ( + BGPPrefixesResource, + AsyncBGPPrefixesResource, + BGPPrefixesResourceWithRawResponse, + AsyncBGPPrefixesResourceWithRawResponse, + BGPPrefixesResourceWithStreamingResponse, + AsyncBGPPrefixesResourceWithStreamingResponse, +) from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import AsyncPaginator, make_request_options +from .service_bindings import ( + ServiceBindingsResource, + AsyncServiceBindingsResource, + ServiceBindingsResourceWithRawResponse, + AsyncServiceBindingsResourceWithRawResponse, + ServiceBindingsResourceWithStreamingResponse, + AsyncServiceBindingsResourceWithStreamingResponse, +) from ....types.addressing import prefix_edit_params, prefix_create_params +from .advertisement_status import ( + AdvertisementStatusResource, + AsyncAdvertisementStatusResource, + AdvertisementStatusResourceWithRawResponse, + AsyncAdvertisementStatusResourceWithRawResponse, + AdvertisementStatusResourceWithStreamingResponse, + AsyncAdvertisementStatusResourceWithStreamingResponse, +) from ....types.addressing.prefix import Prefix from ....types.addressing.prefix_delete_response import PrefixDeleteResponse @@ -47,8 +63,16 @@ class PrefixesResource(SyncAPIResource): @cached_property - def bgp(self) -> BGPResource: - return BGPResource(self._client) + def service_bindings(self) -> ServiceBindingsResource: + return ServiceBindingsResource(self._client) + + @cached_property + def bgp_prefixes(self) -> BGPPrefixesResource: + return BGPPrefixesResource(self._client) + + @cached_property + def advertisement_status(self) -> AdvertisementStatusResource: + return AdvertisementStatusResource(self._client) @cached_property def delegations(self) -> DelegationsResource: @@ -91,7 +115,7 @@ def create( Add a new prefix under the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. asn: Autonomous System Number (ASN) the prefix will be advertised under. @@ -144,7 +168,7 @@ def list( List all prefixes owned by the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. extra_headers: Send extra headers @@ -181,9 +205,9 @@ def delete( Delete an unapproved prefix owned by the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. extra_headers: Send extra headers @@ -222,9 +246,9 @@ def edit( Modify the description for a prefix owned by the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. description: Description of the prefix. @@ -269,9 +293,9 @@ def get( List a particular prefix owned by the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. extra_headers: Send extra headers @@ -300,8 +324,16 @@ def get( class AsyncPrefixesResource(AsyncAPIResource): @cached_property - def bgp(self) -> AsyncBGPResource: - return AsyncBGPResource(self._client) + def service_bindings(self) -> AsyncServiceBindingsResource: + return AsyncServiceBindingsResource(self._client) + + @cached_property + def bgp_prefixes(self) -> AsyncBGPPrefixesResource: + return AsyncBGPPrefixesResource(self._client) + + @cached_property + def advertisement_status(self) -> AsyncAdvertisementStatusResource: + return AsyncAdvertisementStatusResource(self._client) @cached_property def delegations(self) -> AsyncDelegationsResource: @@ -344,7 +376,7 @@ async def create( Add a new prefix under the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. asn: Autonomous System Number (ASN) the prefix will be advertised under. @@ -397,7 +429,7 @@ def list( List all prefixes owned by the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. extra_headers: Send extra headers @@ -434,9 +466,9 @@ async def delete( Delete an unapproved prefix owned by the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. extra_headers: Send extra headers @@ -475,9 +507,9 @@ async def edit( Modify the description for a prefix owned by the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. description: Description of the prefix. @@ -522,9 +554,9 @@ async def get( List a particular prefix owned by the account. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. extra_headers: Send extra headers @@ -572,8 +604,16 @@ def __init__(self, prefixes: PrefixesResource) -> None: ) @cached_property - def bgp(self) -> BGPResourceWithRawResponse: - return BGPResourceWithRawResponse(self._prefixes.bgp) + def service_bindings(self) -> ServiceBindingsResourceWithRawResponse: + return ServiceBindingsResourceWithRawResponse(self._prefixes.service_bindings) + + @cached_property + def bgp_prefixes(self) -> BGPPrefixesResourceWithRawResponse: + return BGPPrefixesResourceWithRawResponse(self._prefixes.bgp_prefixes) + + @cached_property + def advertisement_status(self) -> AdvertisementStatusResourceWithRawResponse: + return AdvertisementStatusResourceWithRawResponse(self._prefixes.advertisement_status) @cached_property def delegations(self) -> DelegationsResourceWithRawResponse: @@ -601,8 +641,16 @@ def __init__(self, prefixes: AsyncPrefixesResource) -> None: ) @cached_property - def bgp(self) -> AsyncBGPResourceWithRawResponse: - return AsyncBGPResourceWithRawResponse(self._prefixes.bgp) + def service_bindings(self) -> AsyncServiceBindingsResourceWithRawResponse: + return AsyncServiceBindingsResourceWithRawResponse(self._prefixes.service_bindings) + + @cached_property + def bgp_prefixes(self) -> AsyncBGPPrefixesResourceWithRawResponse: + return AsyncBGPPrefixesResourceWithRawResponse(self._prefixes.bgp_prefixes) + + @cached_property + def advertisement_status(self) -> AsyncAdvertisementStatusResourceWithRawResponse: + return AsyncAdvertisementStatusResourceWithRawResponse(self._prefixes.advertisement_status) @cached_property def delegations(self) -> AsyncDelegationsResourceWithRawResponse: @@ -630,8 +678,16 @@ def __init__(self, prefixes: PrefixesResource) -> None: ) @cached_property - def bgp(self) -> BGPResourceWithStreamingResponse: - return BGPResourceWithStreamingResponse(self._prefixes.bgp) + def service_bindings(self) -> ServiceBindingsResourceWithStreamingResponse: + return ServiceBindingsResourceWithStreamingResponse(self._prefixes.service_bindings) + + @cached_property + def bgp_prefixes(self) -> BGPPrefixesResourceWithStreamingResponse: + return BGPPrefixesResourceWithStreamingResponse(self._prefixes.bgp_prefixes) + + @cached_property + def advertisement_status(self) -> AdvertisementStatusResourceWithStreamingResponse: + return AdvertisementStatusResourceWithStreamingResponse(self._prefixes.advertisement_status) @cached_property def delegations(self) -> DelegationsResourceWithStreamingResponse: @@ -659,8 +715,16 @@ def __init__(self, prefixes: AsyncPrefixesResource) -> None: ) @cached_property - def bgp(self) -> AsyncBGPResourceWithStreamingResponse: - return AsyncBGPResourceWithStreamingResponse(self._prefixes.bgp) + def service_bindings(self) -> AsyncServiceBindingsResourceWithStreamingResponse: + return AsyncServiceBindingsResourceWithStreamingResponse(self._prefixes.service_bindings) + + @cached_property + def bgp_prefixes(self) -> AsyncBGPPrefixesResourceWithStreamingResponse: + return AsyncBGPPrefixesResourceWithStreamingResponse(self._prefixes.bgp_prefixes) + + @cached_property + def advertisement_status(self) -> AsyncAdvertisementStatusResourceWithStreamingResponse: + return AsyncAdvertisementStatusResourceWithStreamingResponse(self._prefixes.advertisement_status) @cached_property def delegations(self) -> AsyncDelegationsResourceWithStreamingResponse: diff --git a/src/cloudflare/resources/addressing/prefixes/bgp/bindings.py b/src/cloudflare/resources/addressing/prefixes/service_bindings.py similarity index 80% rename from src/cloudflare/resources/addressing/prefixes/bgp/bindings.py rename to src/cloudflare/resources/addressing/prefixes/service_bindings.py index 32a3c303168..c5be5b730ca 100644 --- a/src/cloudflare/resources/addressing/prefixes/bgp/bindings.py +++ b/src/cloudflare/resources/addressing/prefixes/service_bindings.py @@ -6,48 +6,48 @@ import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._utils import ( +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 ( +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....._wrappers import ResultWrapper -from .....pagination import SyncSinglePage, AsyncSinglePage -from ....._base_client import AsyncPaginator, make_request_options -from .....types.addressing.prefixes.bgp import binding_create_params -from .....types.addressing.prefixes.bgp.service_binding import ServiceBinding -from .....types.addressing.prefixes.bgp.binding_delete_response import BindingDeleteResponse +from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage +from ...._base_client import AsyncPaginator, make_request_options +from ....types.addressing.prefixes import service_binding_create_params +from ....types.addressing.prefixes.service_binding import ServiceBinding +from ....types.addressing.prefixes.service_binding_delete_response import ServiceBindingDeleteResponse -__all__ = ["BindingsResource", "AsyncBindingsResource"] +__all__ = ["ServiceBindingsResource", "AsyncServiceBindingsResource"] -class BindingsResource(SyncAPIResource): +class ServiceBindingsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BindingsResourceWithRawResponse: + def with_raw_response(self) -> ServiceBindingsResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers """ - return BindingsResourceWithRawResponse(self) + return ServiceBindingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BindingsResourceWithStreamingResponse: + def with_streaming_response(self) -> ServiceBindingsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response """ - return BindingsResourceWithStreamingResponse(self) + return ServiceBindingsResourceWithStreamingResponse(self) def create( self, @@ -70,13 +70,14 @@ def create( allows creating service bindings for the Cloudflare CDN or Cloudflare Spectrum. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. cidr: IP Prefix in Classless Inter-Domain Routing format. - service_id: Identifier + service_id: Identifier of a Service on the Cloudflare network. Available services and their + IDs may be found in the **List Services** endpoint. extra_headers: Send extra headers @@ -97,7 +98,7 @@ def create( "cidr": cidr, "service_id": service_id, }, - binding_create_params.BindingCreateParams, + service_binding_create_params.ServiceBindingCreateParams, ), options=make_request_options( extra_headers=extra_headers, @@ -131,9 +132,9 @@ def list( IPs in the prefix to Cloudflare Magic Transit. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. extra_headers: Send extra headers @@ -168,16 +169,16 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BindingDeleteResponse: + ) -> ServiceBindingDeleteResponse: """ Delete a Service Binding Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. - binding_id: Identifier + binding_id: Identifier of a Service Binding. extra_headers: Send extra headers @@ -198,7 +199,7 @@ def delete( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=BindingDeleteResponse, + cast_to=ServiceBindingDeleteResponse, ) def get( @@ -218,11 +219,11 @@ def get( Fetch a single Service Binding Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. - binding_id: Identifier + binding_id: Identifier of a Service Binding. extra_headers: Send extra headers @@ -251,25 +252,25 @@ def get( ) -class AsyncBindingsResource(AsyncAPIResource): +class AsyncServiceBindingsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBindingsResourceWithRawResponse: + def with_raw_response(self) -> AsyncServiceBindingsResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers """ - return AsyncBindingsResourceWithRawResponse(self) + return AsyncServiceBindingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBindingsResourceWithStreamingResponse: + def with_streaming_response(self) -> AsyncServiceBindingsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response """ - return AsyncBindingsResourceWithStreamingResponse(self) + return AsyncServiceBindingsResourceWithStreamingResponse(self) async def create( self, @@ -292,13 +293,14 @@ async def create( allows creating service bindings for the Cloudflare CDN or Cloudflare Spectrum. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. cidr: IP Prefix in Classless Inter-Domain Routing format. - service_id: Identifier + service_id: Identifier of a Service on the Cloudflare network. Available services and their + IDs may be found in the **List Services** endpoint. extra_headers: Send extra headers @@ -319,7 +321,7 @@ async def create( "cidr": cidr, "service_id": service_id, }, - binding_create_params.BindingCreateParams, + service_binding_create_params.ServiceBindingCreateParams, ), options=make_request_options( extra_headers=extra_headers, @@ -353,9 +355,9 @@ def list( IPs in the prefix to Cloudflare Magic Transit. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. extra_headers: Send extra headers @@ -390,16 +392,16 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BindingDeleteResponse: + ) -> ServiceBindingDeleteResponse: """ Delete a Service Binding Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. - binding_id: Identifier + binding_id: Identifier of a Service Binding. extra_headers: Send extra headers @@ -420,7 +422,7 @@ async def delete( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=BindingDeleteResponse, + cast_to=ServiceBindingDeleteResponse, ) async def get( @@ -440,11 +442,11 @@ async def get( Fetch a single Service Binding Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. - prefix_id: Identifier + prefix_id: Identifier of an IP Prefix. - binding_id: Identifier + binding_id: Identifier of a Service Binding. extra_headers: Send extra headers @@ -473,73 +475,73 @@ async def get( ) -class BindingsResourceWithRawResponse: - def __init__(self, bindings: BindingsResource) -> None: - self._bindings = bindings +class ServiceBindingsResourceWithRawResponse: + def __init__(self, service_bindings: ServiceBindingsResource) -> None: + self._service_bindings = service_bindings self.create = to_raw_response_wrapper( - bindings.create, + service_bindings.create, ) self.list = to_raw_response_wrapper( - bindings.list, + service_bindings.list, ) self.delete = to_raw_response_wrapper( - bindings.delete, + service_bindings.delete, ) self.get = to_raw_response_wrapper( - bindings.get, + service_bindings.get, ) -class AsyncBindingsResourceWithRawResponse: - def __init__(self, bindings: AsyncBindingsResource) -> None: - self._bindings = bindings +class AsyncServiceBindingsResourceWithRawResponse: + def __init__(self, service_bindings: AsyncServiceBindingsResource) -> None: + self._service_bindings = service_bindings self.create = async_to_raw_response_wrapper( - bindings.create, + service_bindings.create, ) self.list = async_to_raw_response_wrapper( - bindings.list, + service_bindings.list, ) self.delete = async_to_raw_response_wrapper( - bindings.delete, + service_bindings.delete, ) self.get = async_to_raw_response_wrapper( - bindings.get, + service_bindings.get, ) -class BindingsResourceWithStreamingResponse: - def __init__(self, bindings: BindingsResource) -> None: - self._bindings = bindings +class ServiceBindingsResourceWithStreamingResponse: + def __init__(self, service_bindings: ServiceBindingsResource) -> None: + self._service_bindings = service_bindings self.create = to_streamed_response_wrapper( - bindings.create, + service_bindings.create, ) self.list = to_streamed_response_wrapper( - bindings.list, + service_bindings.list, ) self.delete = to_streamed_response_wrapper( - bindings.delete, + service_bindings.delete, ) self.get = to_streamed_response_wrapper( - bindings.get, + service_bindings.get, ) -class AsyncBindingsResourceWithStreamingResponse: - def __init__(self, bindings: AsyncBindingsResource) -> None: - self._bindings = bindings +class AsyncServiceBindingsResourceWithStreamingResponse: + def __init__(self, service_bindings: AsyncServiceBindingsResource) -> None: + self._service_bindings = service_bindings self.create = async_to_streamed_response_wrapper( - bindings.create, + service_bindings.create, ) self.list = async_to_streamed_response_wrapper( - bindings.list, + service_bindings.list, ) self.delete = async_to_streamed_response_wrapper( - bindings.delete, + service_bindings.delete, ) self.get = async_to_streamed_response_wrapper( - bindings.get, + service_bindings.get, ) diff --git a/src/cloudflare/resources/addressing/services.py b/src/cloudflare/resources/addressing/services.py index 56fe70d70b9..e73f0c62298 100644 --- a/src/cloudflare/resources/addressing/services.py +++ b/src/cloudflare/resources/addressing/services.py @@ -58,7 +58,7 @@ def list( the Cloudflare network, and their service IDs. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. extra_headers: Send extra headers @@ -118,7 +118,7 @@ def list( the Cloudflare network, and their service IDs. Args: - account_id: Identifier + account_id: Identifier of a Cloudflare account. extra_headers: Send extra headers diff --git a/src/cloudflare/resources/ai/__init__.py b/src/cloudflare/resources/ai/__init__.py new file mode 100644 index 00000000000..26c6c71d160 --- /dev/null +++ b/src/cloudflare/resources/ai/__init__.py @@ -0,0 +1,75 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .ai import ( + AIResource, + AsyncAIResource, + AIResourceWithRawResponse, + AsyncAIResourceWithRawResponse, + AIResourceWithStreamingResponse, + AsyncAIResourceWithStreamingResponse, +) +from .tasks import ( + TasksResource, + AsyncTasksResource, + TasksResourceWithRawResponse, + AsyncTasksResourceWithRawResponse, + TasksResourceWithStreamingResponse, + AsyncTasksResourceWithStreamingResponse, +) +from .models import ( + ModelsResource, + AsyncModelsResource, + ModelsResourceWithRawResponse, + AsyncModelsResourceWithRawResponse, + ModelsResourceWithStreamingResponse, + AsyncModelsResourceWithStreamingResponse, +) +from .authors import ( + AuthorsResource, + AsyncAuthorsResource, + AuthorsResourceWithRawResponse, + AsyncAuthorsResourceWithRawResponse, + AuthorsResourceWithStreamingResponse, + AsyncAuthorsResourceWithStreamingResponse, +) +from .finetunes import ( + FinetunesResource, + AsyncFinetunesResource, + FinetunesResourceWithRawResponse, + AsyncFinetunesResourceWithRawResponse, + FinetunesResourceWithStreamingResponse, + AsyncFinetunesResourceWithStreamingResponse, +) + +__all__ = [ + "FinetunesResource", + "AsyncFinetunesResource", + "FinetunesResourceWithRawResponse", + "AsyncFinetunesResourceWithRawResponse", + "FinetunesResourceWithStreamingResponse", + "AsyncFinetunesResourceWithStreamingResponse", + "AuthorsResource", + "AsyncAuthorsResource", + "AuthorsResourceWithRawResponse", + "AsyncAuthorsResourceWithRawResponse", + "AuthorsResourceWithStreamingResponse", + "AsyncAuthorsResourceWithStreamingResponse", + "TasksResource", + "AsyncTasksResource", + "TasksResourceWithRawResponse", + "AsyncTasksResourceWithRawResponse", + "TasksResourceWithStreamingResponse", + "AsyncTasksResourceWithStreamingResponse", + "ModelsResource", + "AsyncModelsResource", + "ModelsResourceWithRawResponse", + "AsyncModelsResourceWithRawResponse", + "ModelsResourceWithStreamingResponse", + "AsyncModelsResourceWithStreamingResponse", + "AIResource", + "AsyncAIResource", + "AIResourceWithRawResponse", + "AsyncAIResourceWithRawResponse", + "AIResourceWithStreamingResponse", + "AsyncAIResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/workers/ai/ai.py b/src/cloudflare/resources/ai/ai.py similarity index 94% rename from src/cloudflare/resources/workers/ai/ai.py rename to src/cloudflare/resources/ai/ai.py index 91012966858..396a1360fe9 100644 --- a/src/cloudflare/resources/workers/ai/ai.py +++ b/src/cloudflare/resources/ai/ai.py @@ -7,21 +7,38 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( +from .tasks import ( + TasksResource, + AsyncTasksResource, + TasksResourceWithRawResponse, + AsyncTasksResourceWithRawResponse, + TasksResourceWithStreamingResponse, + AsyncTasksResourceWithStreamingResponse, +) +from .authors import ( + AuthorsResource, + AsyncAuthorsResource, + AuthorsResourceWithRawResponse, + AsyncAuthorsResourceWithRawResponse, + AuthorsResourceWithStreamingResponse, + AsyncAuthorsResourceWithStreamingResponse, +) +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import ( required_args, maybe_transform, async_maybe_transform, ) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ..._compat import cached_property +from ...types.ai import ai_run_params +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 ..._wrappers import ResultWrapper from .models.models import ( ModelsResource, AsyncModelsResource, @@ -30,14 +47,33 @@ ModelsResourceWithStreamingResponse, AsyncModelsResourceWithStreamingResponse, ) -from ...._base_client import make_request_options -from ....types.workers import ai_run_params -from ....types.workers.ai_run_response import AIRunResponse +from ..._base_client import make_request_options +from .finetunes.finetunes import ( + FinetunesResource, + AsyncFinetunesResource, + FinetunesResourceWithRawResponse, + AsyncFinetunesResourceWithRawResponse, + FinetunesResourceWithStreamingResponse, + AsyncFinetunesResourceWithStreamingResponse, +) +from ...types.ai.ai_run_response import AIRunResponse __all__ = ["AIResource", "AsyncAIResource"] class AIResource(SyncAPIResource): + @cached_property + def finetunes(self) -> FinetunesResource: + return FinetunesResource(self._client) + + @cached_property + def authors(self) -> AuthorsResource: + return AuthorsResource(self._client) + + @cached_property + def tasks(self) -> TasksResource: + return TasksResource(self._client) + @cached_property def models(self) -> ModelsResource: return ModelsResource(self._client) @@ -778,6 +814,18 @@ def run( class AsyncAIResource(AsyncAPIResource): + @cached_property + def finetunes(self) -> AsyncFinetunesResource: + return AsyncFinetunesResource(self._client) + + @cached_property + def authors(self) -> AsyncAuthorsResource: + return AsyncAuthorsResource(self._client) + + @cached_property + def tasks(self) -> AsyncTasksResource: + return AsyncTasksResource(self._client) + @cached_property def models(self) -> AsyncModelsResource: return AsyncModelsResource(self._client) @@ -1525,6 +1573,18 @@ def __init__(self, ai: AIResource) -> None: ai.run, ) + @cached_property + def finetunes(self) -> FinetunesResourceWithRawResponse: + return FinetunesResourceWithRawResponse(self._ai.finetunes) + + @cached_property + def authors(self) -> AuthorsResourceWithRawResponse: + return AuthorsResourceWithRawResponse(self._ai.authors) + + @cached_property + def tasks(self) -> TasksResourceWithRawResponse: + return TasksResourceWithRawResponse(self._ai.tasks) + @cached_property def models(self) -> ModelsResourceWithRawResponse: return ModelsResourceWithRawResponse(self._ai.models) @@ -1538,6 +1598,18 @@ def __init__(self, ai: AsyncAIResource) -> None: ai.run, ) + @cached_property + def finetunes(self) -> AsyncFinetunesResourceWithRawResponse: + return AsyncFinetunesResourceWithRawResponse(self._ai.finetunes) + + @cached_property + def authors(self) -> AsyncAuthorsResourceWithRawResponse: + return AsyncAuthorsResourceWithRawResponse(self._ai.authors) + + @cached_property + def tasks(self) -> AsyncTasksResourceWithRawResponse: + return AsyncTasksResourceWithRawResponse(self._ai.tasks) + @cached_property def models(self) -> AsyncModelsResourceWithRawResponse: return AsyncModelsResourceWithRawResponse(self._ai.models) @@ -1551,6 +1623,18 @@ def __init__(self, ai: AIResource) -> None: ai.run, ) + @cached_property + def finetunes(self) -> FinetunesResourceWithStreamingResponse: + return FinetunesResourceWithStreamingResponse(self._ai.finetunes) + + @cached_property + def authors(self) -> AuthorsResourceWithStreamingResponse: + return AuthorsResourceWithStreamingResponse(self._ai.authors) + + @cached_property + def tasks(self) -> TasksResourceWithStreamingResponse: + return TasksResourceWithStreamingResponse(self._ai.tasks) + @cached_property def models(self) -> ModelsResourceWithStreamingResponse: return ModelsResourceWithStreamingResponse(self._ai.models) @@ -1564,6 +1648,18 @@ def __init__(self, ai: AsyncAIResource) -> None: ai.run, ) + @cached_property + def finetunes(self) -> AsyncFinetunesResourceWithStreamingResponse: + return AsyncFinetunesResourceWithStreamingResponse(self._ai.finetunes) + + @cached_property + def authors(self) -> AsyncAuthorsResourceWithStreamingResponse: + return AsyncAuthorsResourceWithStreamingResponse(self._ai.authors) + + @cached_property + def tasks(self) -> AsyncTasksResourceWithStreamingResponse: + return AsyncTasksResourceWithStreamingResponse(self._ai.tasks) + @cached_property def models(self) -> AsyncModelsResourceWithStreamingResponse: return AsyncModelsResourceWithStreamingResponse(self._ai.models) diff --git a/src/cloudflare/resources/ai/authors.py b/src/cloudflare/resources/ai/authors.py new file mode 100644 index 00000000000..ecf213ff048 --- /dev/null +++ b/src/cloudflare/resources/ai/authors.py @@ -0,0 +1,165 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...pagination import SyncSinglePage, AsyncSinglePage +from ..._base_client import AsyncPaginator, make_request_options + +__all__ = ["AuthorsResource", "AsyncAuthorsResource"] + + +class AuthorsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AuthorsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AuthorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AuthorsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AuthorsResourceWithStreamingResponse(self) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncSinglePage[object]: + """ + Author Search + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/ai/authors/search", + page=SyncSinglePage[object], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=object, + ) + + +class AsyncAuthorsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAuthorsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncAuthorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAuthorsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncAuthorsResourceWithStreamingResponse(self) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[object, AsyncSinglePage[object]]: + """ + Author Search + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/ai/authors/search", + page=AsyncSinglePage[object], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=object, + ) + + +class AuthorsResourceWithRawResponse: + def __init__(self, authors: AuthorsResource) -> None: + self._authors = authors + + self.list = to_raw_response_wrapper( + authors.list, + ) + + +class AsyncAuthorsResourceWithRawResponse: + def __init__(self, authors: AsyncAuthorsResource) -> None: + self._authors = authors + + self.list = async_to_raw_response_wrapper( + authors.list, + ) + + +class AuthorsResourceWithStreamingResponse: + def __init__(self, authors: AuthorsResource) -> None: + self._authors = authors + + self.list = to_streamed_response_wrapper( + authors.list, + ) + + +class AsyncAuthorsResourceWithStreamingResponse: + def __init__(self, authors: AsyncAuthorsResource) -> None: + self._authors = authors + + self.list = async_to_streamed_response_wrapper( + authors.list, + ) diff --git a/src/cloudflare/resources/ai/finetunes/__init__.py b/src/cloudflare/resources/ai/finetunes/__init__.py new file mode 100644 index 00000000000..57d977a86f3 --- /dev/null +++ b/src/cloudflare/resources/ai/finetunes/__init__.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .assets import ( + AssetsResource, + AsyncAssetsResource, + AssetsResourceWithRawResponse, + AsyncAssetsResourceWithRawResponse, + AssetsResourceWithStreamingResponse, + AsyncAssetsResourceWithStreamingResponse, +) +from .public import ( + PublicResource, + AsyncPublicResource, + PublicResourceWithRawResponse, + AsyncPublicResourceWithRawResponse, + PublicResourceWithStreamingResponse, + AsyncPublicResourceWithStreamingResponse, +) +from .finetunes import ( + FinetunesResource, + AsyncFinetunesResource, + FinetunesResourceWithRawResponse, + AsyncFinetunesResourceWithRawResponse, + FinetunesResourceWithStreamingResponse, + AsyncFinetunesResourceWithStreamingResponse, +) + +__all__ = [ + "AssetsResource", + "AsyncAssetsResource", + "AssetsResourceWithRawResponse", + "AsyncAssetsResourceWithRawResponse", + "AssetsResourceWithStreamingResponse", + "AsyncAssetsResourceWithStreamingResponse", + "PublicResource", + "AsyncPublicResource", + "PublicResourceWithRawResponse", + "AsyncPublicResourceWithRawResponse", + "PublicResourceWithStreamingResponse", + "AsyncPublicResourceWithStreamingResponse", + "FinetunesResource", + "AsyncFinetunesResource", + "FinetunesResourceWithRawResponse", + "AsyncFinetunesResourceWithRawResponse", + "FinetunesResourceWithStreamingResponse", + "AsyncFinetunesResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/ai/finetunes/assets.py b/src/cloudflare/resources/ai/finetunes/assets.py new file mode 100644 index 00000000000..dfeb072ae01 --- /dev/null +++ b/src/cloudflare/resources/ai/finetunes/assets.py @@ -0,0 +1,217 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Type, Mapping, cast + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes +from ...._utils import ( + extract_files, + maybe_transform, + deepcopy_minimal, + 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.ai.finetunes import asset_create_params +from ....types.ai.finetunes.asset_create_response import AssetCreateResponse + +__all__ = ["AssetsResource", "AsyncAssetsResource"] + + +class AssetsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AssetsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AssetsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AssetsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AssetsResourceWithStreamingResponse(self) + + def create( + self, + finetune_id: str, + *, + account_id: str, + file: FileTypes | NotGiven = NOT_GIVEN, + file_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, + ) -> AssetCreateResponse: + """ + Upload a Finetune Asset + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not finetune_id: + raise ValueError(f"Expected a non-empty value for `finetune_id` but received {finetune_id!r}") + body = deepcopy_minimal( + { + "file": file, + "file_name": file_name, + } + ) + files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) + # It should be noted that the actual Content-Type header that will be + # sent to the server will contain a `boundary` parameter, e.g. + # multipart/form-data; boundary=---abc-- + extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} + return self._post( + f"/accounts/{account_id}/ai/finetunes/{finetune_id}/finetune-assets", + body=maybe_transform(body, asset_create_params.AssetCreateParams), + files=files, + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[AssetCreateResponse]._unwrapper, + ), + cast_to=cast(Type[AssetCreateResponse], ResultWrapper[AssetCreateResponse]), + ) + + +class AsyncAssetsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAssetsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncAssetsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAssetsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncAssetsResourceWithStreamingResponse(self) + + async def create( + self, + finetune_id: str, + *, + account_id: str, + file: FileTypes | NotGiven = NOT_GIVEN, + file_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, + ) -> AssetCreateResponse: + """ + Upload a Finetune Asset + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not finetune_id: + raise ValueError(f"Expected a non-empty value for `finetune_id` but received {finetune_id!r}") + body = deepcopy_minimal( + { + "file": file, + "file_name": file_name, + } + ) + files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) + # It should be noted that the actual Content-Type header that will be + # sent to the server will contain a `boundary` parameter, e.g. + # multipart/form-data; boundary=---abc-- + extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} + return await self._post( + f"/accounts/{account_id}/ai/finetunes/{finetune_id}/finetune-assets", + body=await async_maybe_transform(body, asset_create_params.AssetCreateParams), + files=files, + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[AssetCreateResponse]._unwrapper, + ), + cast_to=cast(Type[AssetCreateResponse], ResultWrapper[AssetCreateResponse]), + ) + + +class AssetsResourceWithRawResponse: + def __init__(self, assets: AssetsResource) -> None: + self._assets = assets + + self.create = to_raw_response_wrapper( + assets.create, + ) + + +class AsyncAssetsResourceWithRawResponse: + def __init__(self, assets: AsyncAssetsResource) -> None: + self._assets = assets + + self.create = async_to_raw_response_wrapper( + assets.create, + ) + + +class AssetsResourceWithStreamingResponse: + def __init__(self, assets: AssetsResource) -> None: + self._assets = assets + + self.create = to_streamed_response_wrapper( + assets.create, + ) + + +class AsyncAssetsResourceWithStreamingResponse: + def __init__(self, assets: AsyncAssetsResource) -> None: + self._assets = assets + + self.create = async_to_streamed_response_wrapper( + assets.create, + ) diff --git a/src/cloudflare/resources/ai/finetunes/finetunes.py b/src/cloudflare/resources/ai/finetunes/finetunes.py new file mode 100644 index 00000000000..1cdef4efc51 --- /dev/null +++ b/src/cloudflare/resources/ai/finetunes/finetunes.py @@ -0,0 +1,356 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Type, cast + +import httpx + +from .assets import ( + AssetsResource, + AsyncAssetsResource, + AssetsResourceWithRawResponse, + AsyncAssetsResourceWithRawResponse, + AssetsResourceWithStreamingResponse, + AsyncAssetsResourceWithStreamingResponse, +) +from .public import ( + PublicResource, + AsyncPublicResource, + PublicResourceWithRawResponse, + AsyncPublicResourceWithRawResponse, + PublicResourceWithStreamingResponse, + AsyncPublicResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import ( + maybe_transform, + async_maybe_transform, +) +from ...._compat import cached_property +from ....types.ai import finetune_create_params +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.ai.finetune_list_response import FinetuneListResponse +from ....types.ai.finetune_create_response import FinetuneCreateResponse + +__all__ = ["FinetunesResource", "AsyncFinetunesResource"] + + +class FinetunesResource(SyncAPIResource): + @cached_property + def assets(self) -> AssetsResource: + return AssetsResource(self._client) + + @cached_property + def public(self) -> PublicResource: + return PublicResource(self._client) + + @cached_property + def with_raw_response(self) -> FinetunesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return FinetunesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FinetunesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return FinetunesResourceWithStreamingResponse(self) + + def create( + self, + *, + account_id: str, + model: str, + name: str, + description: str | NotGiven = NOT_GIVEN, + public: 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, + ) -> FinetuneCreateResponse: + """ + Create a new Finetune + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._post( + f"/accounts/{account_id}/ai/finetunes", + body=maybe_transform( + { + "model": model, + "name": name, + "description": description, + "public": public, + }, + finetune_create_params.FinetuneCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[FinetuneCreateResponse]._unwrapper, + ), + cast_to=cast(Type[FinetuneCreateResponse], ResultWrapper[FinetuneCreateResponse]), + ) + + 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, + ) -> FinetuneListResponse: + """ + List Finetunes + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get( + f"/accounts/{account_id}/ai/finetunes", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[FinetuneListResponse]._unwrapper, + ), + cast_to=cast(Type[FinetuneListResponse], ResultWrapper[FinetuneListResponse]), + ) + + +class AsyncFinetunesResource(AsyncAPIResource): + @cached_property + def assets(self) -> AsyncAssetsResource: + return AsyncAssetsResource(self._client) + + @cached_property + def public(self) -> AsyncPublicResource: + return AsyncPublicResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncFinetunesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncFinetunesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFinetunesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncFinetunesResourceWithStreamingResponse(self) + + async def create( + self, + *, + account_id: str, + model: str, + name: str, + description: str | NotGiven = NOT_GIVEN, + public: 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, + ) -> FinetuneCreateResponse: + """ + Create a new Finetune + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return await self._post( + f"/accounts/{account_id}/ai/finetunes", + body=await async_maybe_transform( + { + "model": model, + "name": name, + "description": description, + "public": public, + }, + finetune_create_params.FinetuneCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[FinetuneCreateResponse]._unwrapper, + ), + cast_to=cast(Type[FinetuneCreateResponse], ResultWrapper[FinetuneCreateResponse]), + ) + + 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, + ) -> FinetuneListResponse: + """ + List Finetunes + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return await self._get( + f"/accounts/{account_id}/ai/finetunes", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[FinetuneListResponse]._unwrapper, + ), + cast_to=cast(Type[FinetuneListResponse], ResultWrapper[FinetuneListResponse]), + ) + + +class FinetunesResourceWithRawResponse: + def __init__(self, finetunes: FinetunesResource) -> None: + self._finetunes = finetunes + + self.create = to_raw_response_wrapper( + finetunes.create, + ) + self.list = to_raw_response_wrapper( + finetunes.list, + ) + + @cached_property + def assets(self) -> AssetsResourceWithRawResponse: + return AssetsResourceWithRawResponse(self._finetunes.assets) + + @cached_property + def public(self) -> PublicResourceWithRawResponse: + return PublicResourceWithRawResponse(self._finetunes.public) + + +class AsyncFinetunesResourceWithRawResponse: + def __init__(self, finetunes: AsyncFinetunesResource) -> None: + self._finetunes = finetunes + + self.create = async_to_raw_response_wrapper( + finetunes.create, + ) + self.list = async_to_raw_response_wrapper( + finetunes.list, + ) + + @cached_property + def assets(self) -> AsyncAssetsResourceWithRawResponse: + return AsyncAssetsResourceWithRawResponse(self._finetunes.assets) + + @cached_property + def public(self) -> AsyncPublicResourceWithRawResponse: + return AsyncPublicResourceWithRawResponse(self._finetunes.public) + + +class FinetunesResourceWithStreamingResponse: + def __init__(self, finetunes: FinetunesResource) -> None: + self._finetunes = finetunes + + self.create = to_streamed_response_wrapper( + finetunes.create, + ) + self.list = to_streamed_response_wrapper( + finetunes.list, + ) + + @cached_property + def assets(self) -> AssetsResourceWithStreamingResponse: + return AssetsResourceWithStreamingResponse(self._finetunes.assets) + + @cached_property + def public(self) -> PublicResourceWithStreamingResponse: + return PublicResourceWithStreamingResponse(self._finetunes.public) + + +class AsyncFinetunesResourceWithStreamingResponse: + def __init__(self, finetunes: AsyncFinetunesResource) -> None: + self._finetunes = finetunes + + self.create = async_to_streamed_response_wrapper( + finetunes.create, + ) + self.list = async_to_streamed_response_wrapper( + finetunes.list, + ) + + @cached_property + def assets(self) -> AsyncAssetsResourceWithStreamingResponse: + return AsyncAssetsResourceWithStreamingResponse(self._finetunes.assets) + + @cached_property + def public(self) -> AsyncPublicResourceWithStreamingResponse: + return AsyncPublicResourceWithStreamingResponse(self._finetunes.public) diff --git a/src/cloudflare/resources/ai/finetunes/public.py b/src/cloudflare/resources/ai/finetunes/public.py new file mode 100644 index 00000000000..74c49e747fa --- /dev/null +++ b/src/cloudflare/resources/ai/finetunes/public.py @@ -0,0 +1,208 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._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 SyncSinglePage, AsyncSinglePage +from ...._base_client import AsyncPaginator, make_request_options +from ....types.ai.finetunes import public_list_params +from ....types.ai.finetunes.public_list_response import PublicListResponse + +__all__ = ["PublicResource", "AsyncPublicResource"] + + +class PublicResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> PublicResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return PublicResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PublicResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return PublicResourceWithStreamingResponse(self) + + def list( + self, + *, + account_id: str, + limit: float | NotGiven = NOT_GIVEN, + offset: float | NotGiven = NOT_GIVEN, + order_by: 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, + ) -> SyncSinglePage[PublicListResponse]: + """ + List Public Finetunes + + Args: + limit: Pagination Limit + + offset: Pagination Offset + + order_by: Order By Column Name + + 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}/ai/finetunes/public", + page=SyncSinglePage[PublicListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "offset": offset, + "order_by": order_by, + }, + public_list_params.PublicListParams, + ), + ), + model=PublicListResponse, + ) + + +class AsyncPublicResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncPublicResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncPublicResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPublicResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncPublicResourceWithStreamingResponse(self) + + def list( + self, + *, + account_id: str, + limit: float | NotGiven = NOT_GIVEN, + offset: float | NotGiven = NOT_GIVEN, + order_by: 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[PublicListResponse, AsyncSinglePage[PublicListResponse]]: + """ + List Public Finetunes + + Args: + limit: Pagination Limit + + offset: Pagination Offset + + order_by: Order By Column Name + + 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}/ai/finetunes/public", + page=AsyncSinglePage[PublicListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "offset": offset, + "order_by": order_by, + }, + public_list_params.PublicListParams, + ), + ), + model=PublicListResponse, + ) + + +class PublicResourceWithRawResponse: + def __init__(self, public: PublicResource) -> None: + self._public = public + + self.list = to_raw_response_wrapper( + public.list, + ) + + +class AsyncPublicResourceWithRawResponse: + def __init__(self, public: AsyncPublicResource) -> None: + self._public = public + + self.list = async_to_raw_response_wrapper( + public.list, + ) + + +class PublicResourceWithStreamingResponse: + def __init__(self, public: PublicResource) -> None: + self._public = public + + self.list = to_streamed_response_wrapper( + public.list, + ) + + +class AsyncPublicResourceWithStreamingResponse: + def __init__(self, public: AsyncPublicResource) -> None: + self._public = public + + self.list = async_to_streamed_response_wrapper( + public.list, + ) diff --git a/src/cloudflare/resources/workers/ai/models/__init__.py b/src/cloudflare/resources/ai/models/__init__.py similarity index 100% rename from src/cloudflare/resources/workers/ai/models/__init__.py rename to src/cloudflare/resources/ai/models/__init__.py diff --git a/src/cloudflare/resources/ai/models/models.py b/src/cloudflare/resources/ai/models/models.py new file mode 100644 index 00000000000..66a2394f641 --- /dev/null +++ b/src/cloudflare/resources/ai/models/models.py @@ -0,0 +1,263 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .schema import ( + SchemaResource, + AsyncSchemaResource, + SchemaResourceWithRawResponse, + AsyncSchemaResourceWithRawResponse, + SchemaResourceWithStreamingResponse, + AsyncSchemaResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform +from ...._compat import cached_property +from ....types.ai import model_list_params +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__ = ["ModelsResource", "AsyncModelsResource"] + + +class ModelsResource(SyncAPIResource): + @cached_property + def schema(self) -> SchemaResource: + return SchemaResource(self._client) + + @cached_property + def with_raw_response(self) -> ModelsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return ModelsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ModelsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return ModelsResourceWithStreamingResponse(self) + + def list( + self, + *, + account_id: str, + author: str | NotGiven = NOT_GIVEN, + hide_experimental: bool | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | NotGiven = NOT_GIVEN, + search: str | NotGiven = NOT_GIVEN, + source: float | NotGiven = NOT_GIVEN, + task: 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, + ) -> SyncV4PagePaginationArray[object]: + """ + Model Search + + Args: + author: Filter by Author + + hide_experimental: Filter to hide experimental models + + search: Search + + source: Filter by Source Id + + task: Filter by Task Name + + 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}/ai/models/search", + page=SyncV4PagePaginationArray[object], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "author": author, + "hide_experimental": hide_experimental, + "page": page, + "per_page": per_page, + "search": search, + "source": source, + "task": task, + }, + model_list_params.ModelListParams, + ), + ), + model=object, + ) + + +class AsyncModelsResource(AsyncAPIResource): + @cached_property + def schema(self) -> AsyncSchemaResource: + return AsyncSchemaResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncModelsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncModelsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncModelsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncModelsResourceWithStreamingResponse(self) + + def list( + self, + *, + account_id: str, + author: str | NotGiven = NOT_GIVEN, + hide_experimental: bool | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | NotGiven = NOT_GIVEN, + search: str | NotGiven = NOT_GIVEN, + source: float | NotGiven = NOT_GIVEN, + task: 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[object, AsyncV4PagePaginationArray[object]]: + """ + Model Search + + Args: + author: Filter by Author + + hide_experimental: Filter to hide experimental models + + search: Search + + source: Filter by Source Id + + task: Filter by Task Name + + 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}/ai/models/search", + page=AsyncV4PagePaginationArray[object], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "author": author, + "hide_experimental": hide_experimental, + "page": page, + "per_page": per_page, + "search": search, + "source": source, + "task": task, + }, + model_list_params.ModelListParams, + ), + ), + model=object, + ) + + +class ModelsResourceWithRawResponse: + def __init__(self, models: ModelsResource) -> None: + self._models = models + + self.list = to_raw_response_wrapper( + models.list, + ) + + @cached_property + def schema(self) -> SchemaResourceWithRawResponse: + return SchemaResourceWithRawResponse(self._models.schema) + + +class AsyncModelsResourceWithRawResponse: + def __init__(self, models: AsyncModelsResource) -> None: + self._models = models + + self.list = async_to_raw_response_wrapper( + models.list, + ) + + @cached_property + def schema(self) -> AsyncSchemaResourceWithRawResponse: + return AsyncSchemaResourceWithRawResponse(self._models.schema) + + +class ModelsResourceWithStreamingResponse: + def __init__(self, models: ModelsResource) -> None: + self._models = models + + self.list = to_streamed_response_wrapper( + models.list, + ) + + @cached_property + def schema(self) -> SchemaResourceWithStreamingResponse: + return SchemaResourceWithStreamingResponse(self._models.schema) + + +class AsyncModelsResourceWithStreamingResponse: + def __init__(self, models: AsyncModelsResource) -> None: + self._models = models + + self.list = async_to_streamed_response_wrapper( + models.list, + ) + + @cached_property + def schema(self) -> AsyncSchemaResourceWithStreamingResponse: + return AsyncSchemaResourceWithStreamingResponse(self._models.schema) diff --git a/src/cloudflare/resources/workers/ai/models/schema.py b/src/cloudflare/resources/ai/models/schema.py similarity index 94% rename from src/cloudflare/resources/workers/ai/models/schema.py rename to src/cloudflare/resources/ai/models/schema.py index 93f1363a597..be4afa7007f 100644 --- a/src/cloudflare/resources/workers/ai/models/schema.py +++ b/src/cloudflare/resources/ai/models/schema.py @@ -6,22 +6,22 @@ import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._utils import ( +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 ( +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.workers.ai.models import schema_get_params +from ...._wrappers import ResultWrapper +from ...._base_client import make_request_options +from ....types.ai.models import schema_get_params __all__ = ["SchemaResource", "AsyncSchemaResource"] diff --git a/src/cloudflare/resources/ai/tasks.py b/src/cloudflare/resources/ai/tasks.py new file mode 100644 index 00000000000..c2b6cae396a --- /dev/null +++ b/src/cloudflare/resources/ai/tasks.py @@ -0,0 +1,165 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...pagination import SyncSinglePage, AsyncSinglePage +from ..._base_client import AsyncPaginator, make_request_options + +__all__ = ["TasksResource", "AsyncTasksResource"] + + +class TasksResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TasksResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return TasksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TasksResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return TasksResourceWithStreamingResponse(self) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncSinglePage[object]: + """ + Task Search + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/ai/tasks/search", + page=SyncSinglePage[object], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=object, + ) + + +class AsyncTasksResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTasksResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncTasksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTasksResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncTasksResourceWithStreamingResponse(self) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[object, AsyncSinglePage[object]]: + """ + Task Search + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/ai/tasks/search", + page=AsyncSinglePage[object], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=object, + ) + + +class TasksResourceWithRawResponse: + def __init__(self, tasks: TasksResource) -> None: + self._tasks = tasks + + self.list = to_raw_response_wrapper( + tasks.list, + ) + + +class AsyncTasksResourceWithRawResponse: + def __init__(self, tasks: AsyncTasksResource) -> None: + self._tasks = tasks + + self.list = async_to_raw_response_wrapper( + tasks.list, + ) + + +class TasksResourceWithStreamingResponse: + def __init__(self, tasks: TasksResource) -> None: + self._tasks = tasks + + self.list = to_streamed_response_wrapper( + tasks.list, + ) + + +class AsyncTasksResourceWithStreamingResponse: + def __init__(self, tasks: AsyncTasksResource) -> None: + self._tasks = tasks + + self.list = async_to_streamed_response_wrapper( + tasks.list, + ) diff --git a/src/cloudflare/resources/ai_gateway/ai_gateway.py b/src/cloudflare/resources/ai_gateway/ai_gateway.py index c10d86e5d9c..ebbaa17ba8b 100644 --- a/src/cloudflare/resources/ai_gateway/ai_gateway.py +++ b/src/cloudflare/resources/ai_gateway/ai_gateway.py @@ -230,8 +230,6 @@ def list( self, *, account_id: str, - order_by: str | NotGiven = NOT_GIVEN, - order_by_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, per_page: int | NotGiven = NOT_GIVEN, search: str | NotGiven = NOT_GIVEN, @@ -246,10 +244,6 @@ def list( List Gateways Args: - order_by: Order By Column Name - - order_by_direction: Order By Direction - search: Search by id extra_headers: Send extra headers @@ -272,8 +266,6 @@ def list( timeout=timeout, query=maybe_transform( { - "order_by": order_by, - "order_by_direction": order_by_direction, "page": page, "per_page": per_page, "search": search, @@ -534,8 +526,6 @@ def list( self, *, account_id: str, - order_by: str | NotGiven = NOT_GIVEN, - order_by_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, per_page: int | NotGiven = NOT_GIVEN, search: str | NotGiven = NOT_GIVEN, @@ -550,10 +540,6 @@ def list( List Gateways Args: - order_by: Order By Column Name - - order_by_direction: Order By Direction - search: Search by id extra_headers: Send extra headers @@ -576,8 +562,6 @@ def list( timeout=timeout, query=maybe_transform( { - "order_by": order_by, - "order_by_direction": order_by_direction, "page": page, "per_page": per_page, "search": search, diff --git a/src/cloudflare/resources/ai_gateway/datasets.py b/src/cloudflare/resources/ai_gateway/datasets.py index 855cad685de..3d58ec297b4 100644 --- a/src/cloudflare/resources/ai_gateway/datasets.py +++ b/src/cloudflare/resources/ai_gateway/datasets.py @@ -3,7 +3,6 @@ from __future__ import annotations from typing import Type, Iterable, cast -from typing_extensions import Literal import httpx @@ -169,8 +168,6 @@ def list( account_id: str, enable: bool | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - order_by_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, per_page: int | NotGiven = NOT_GIVEN, search: str | NotGiven = NOT_GIVEN, @@ -187,10 +184,6 @@ def list( Args: gateway_id: gateway id - order_by: Order By Column Name - - order_by_direction: Order By Direction - search: Search by id, name, filters extra_headers: Send extra headers @@ -217,8 +210,6 @@ def list( { "enable": enable, "name": name, - "order_by": order_by, - "order_by_direction": order_by_direction, "page": page, "per_page": per_page, "search": search, @@ -456,8 +447,6 @@ def list( account_id: str, enable: bool | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - order_by_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, per_page: int | NotGiven = NOT_GIVEN, search: str | NotGiven = NOT_GIVEN, @@ -474,10 +463,6 @@ def list( Args: gateway_id: gateway id - order_by: Order By Column Name - - order_by_direction: Order By Direction - search: Search by id, name, filters extra_headers: Send extra headers @@ -504,8 +489,6 @@ def list( { "enable": enable, "name": name, - "order_by": order_by, - "order_by_direction": order_by_direction, "page": page, "per_page": per_page, "search": search, diff --git a/src/cloudflare/resources/ai_gateway/evaluations.py b/src/cloudflare/resources/ai_gateway/evaluations.py index d0a00012074..5dbccd8f358 100644 --- a/src/cloudflare/resources/ai_gateway/evaluations.py +++ b/src/cloudflare/resources/ai_gateway/evaluations.py @@ -3,7 +3,6 @@ from __future__ import annotations from typing import List, Type, cast -from typing_extensions import Literal import httpx @@ -111,8 +110,6 @@ def list( *, account_id: str, name: str | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - order_by_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, per_page: int | NotGiven = NOT_GIVEN, processed: bool | NotGiven = NOT_GIVEN, @@ -130,10 +127,6 @@ def list( Args: gateway_id: gateway id - order_by: Order By Column Name - - order_by_direction: Order By Direction - search: Search by id, name extra_headers: Send extra headers @@ -159,8 +152,6 @@ def list( query=maybe_transform( { "name": name, - "order_by": order_by, - "order_by_direction": order_by_direction, "page": page, "per_page": per_page, "processed": processed, @@ -342,8 +333,6 @@ def list( *, account_id: str, name: str | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - order_by_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, per_page: int | NotGiven = NOT_GIVEN, processed: bool | NotGiven = NOT_GIVEN, @@ -361,10 +350,6 @@ def list( Args: gateway_id: gateway id - order_by: Order By Column Name - - order_by_direction: Order By Direction - search: Search by id, name extra_headers: Send extra headers @@ -390,8 +375,6 @@ def list( query=maybe_transform( { "name": name, - "order_by": order_by, - "order_by_direction": order_by_direction, "page": page, "per_page": per_page, "processed": processed, diff --git a/src/cloudflare/resources/api_gateway/operations/operations.py b/src/cloudflare/resources/api_gateway/operations/operations.py index 4e2c044805e..2681b95f944 100644 --- a/src/cloudflare/resources/api_gateway/operations/operations.py +++ b/src/cloudflare/resources/api_gateway/operations/operations.py @@ -31,11 +31,17 @@ SchemaValidationResourceWithStreamingResponse, AsyncSchemaValidationResourceWithStreamingResponse, ) -from ....types.api_gateway import operation_get_params, operation_list_params, operation_create_params +from ....types.api_gateway import ( + operation_get_params, + operation_list_params, + operation_create_params, + operation_bulk_create_params, +) from ....types.api_gateway.operation_get_response import OperationGetResponse from ....types.api_gateway.operation_list_response import OperationListResponse from ....types.api_gateway.operation_create_response import OperationCreateResponse from ....types.api_gateway.operation_delete_response import OperationDeleteResponse +from ....types.api_gateway.operation_bulk_create_response import OperationBulkCreateResponse from ....types.api_gateway.operation_bulk_delete_response import OperationBulkDeleteResponse __all__ = ["OperationsResource", "AsyncOperationsResource"] @@ -69,7 +75,9 @@ def create( self, *, zone_id: str, - body: Iterable[operation_create_params.Body], + endpoint: str, + host: str, + method: Literal["GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "CONNECT", "PATCH", "TRACE"], # 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, @@ -77,17 +85,26 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> OperationCreateResponse: - """Add one or more operations to a zone. + """Add one operation to a zone. - Endpoints can contain path variables. - Host, method, endpoint will be normalized to a canoncial form when creating an - operation and must be unique on the zone. Inserting an operation that matches an - existing one will return the record of the already existing operation and update - its last_updated date. + Endpoints can contain path variables. Host, method, + endpoint will be normalized to a canoncial form when creating an operation and + must be unique on the zone. Inserting an operation that matches an existing one + will return the record of the already existing operation and update its + last_updated date. Args: zone_id: Identifier + endpoint: The endpoint which can contain path parameter templates in curly braces, each + will be replaced from left to right with {varN}, starting with {var1}, during + insertion. This will further be Cloudflare-normalized upon insertion. See: + https://developers.cloudflare.com/rules/normalization/how-it-works/. + + host: RFC3986-compliant host. + + method: The HTTP method used to access the endpoint. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -99,8 +116,15 @@ def create( if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return self._post( - f"/zones/{zone_id}/api_gateway/operations", - body=maybe_transform(body, Iterable[operation_create_params.Body]), + f"/zones/{zone_id}/api_gateway/operations/item", + body=maybe_transform( + { + "endpoint": endpoint, + "host": host, + "method": method, + }, + operation_create_params.OperationCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -230,6 +254,52 @@ def delete( cast_to=OperationDeleteResponse, ) + def bulk_create( + self, + *, + zone_id: str, + body: Iterable[operation_bulk_create_params.Body], + # 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, + ) -> OperationBulkCreateResponse: + """Add one or more operations to a zone. + + Endpoints can contain path variables. + Host, method, endpoint will be normalized to a canoncial form when creating an + operation and must be unique on the zone. Inserting an operation that matches an + existing one will return the record of the already existing operation and update + its last_updated date. + + Args: + zone_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 zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return self._post( + f"/zones/{zone_id}/api_gateway/operations", + body=maybe_transform(body, Iterable[operation_bulk_create_params.Body]), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[OperationBulkCreateResponse]._unwrapper, + ), + cast_to=cast(Type[OperationBulkCreateResponse], ResultWrapper[OperationBulkCreateResponse]), + ) + def bulk_delete( self, *, @@ -344,7 +414,9 @@ async def create( self, *, zone_id: str, - body: Iterable[operation_create_params.Body], + endpoint: str, + host: str, + method: Literal["GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "CONNECT", "PATCH", "TRACE"], # 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, @@ -352,17 +424,26 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> OperationCreateResponse: - """Add one or more operations to a zone. + """Add one operation to a zone. - Endpoints can contain path variables. - Host, method, endpoint will be normalized to a canoncial form when creating an - operation and must be unique on the zone. Inserting an operation that matches an - existing one will return the record of the already existing operation and update - its last_updated date. + Endpoints can contain path variables. Host, method, + endpoint will be normalized to a canoncial form when creating an operation and + must be unique on the zone. Inserting an operation that matches an existing one + will return the record of the already existing operation and update its + last_updated date. Args: zone_id: Identifier + endpoint: The endpoint which can contain path parameter templates in curly braces, each + will be replaced from left to right with {varN}, starting with {var1}, during + insertion. This will further be Cloudflare-normalized upon insertion. See: + https://developers.cloudflare.com/rules/normalization/how-it-works/. + + host: RFC3986-compliant host. + + method: The HTTP method used to access the endpoint. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -374,8 +455,15 @@ async def create( if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return await self._post( - f"/zones/{zone_id}/api_gateway/operations", - body=await async_maybe_transform(body, Iterable[operation_create_params.Body]), + f"/zones/{zone_id}/api_gateway/operations/item", + body=await async_maybe_transform( + { + "endpoint": endpoint, + "host": host, + "method": method, + }, + operation_create_params.OperationCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -505,6 +593,52 @@ async def delete( cast_to=OperationDeleteResponse, ) + async def bulk_create( + self, + *, + zone_id: str, + body: Iterable[operation_bulk_create_params.Body], + # 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, + ) -> OperationBulkCreateResponse: + """Add one or more operations to a zone. + + Endpoints can contain path variables. + Host, method, endpoint will be normalized to a canoncial form when creating an + operation and must be unique on the zone. Inserting an operation that matches an + existing one will return the record of the already existing operation and update + its last_updated date. + + Args: + zone_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 zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return await self._post( + f"/zones/{zone_id}/api_gateway/operations", + body=await async_maybe_transform(body, Iterable[operation_bulk_create_params.Body]), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[OperationBulkCreateResponse]._unwrapper, + ), + cast_to=cast(Type[OperationBulkCreateResponse], ResultWrapper[OperationBulkCreateResponse]), + ) + async def bulk_delete( self, *, @@ -604,6 +738,9 @@ def __init__(self, operations: OperationsResource) -> None: self.delete = to_raw_response_wrapper( operations.delete, ) + self.bulk_create = to_raw_response_wrapper( + operations.bulk_create, + ) self.bulk_delete = to_raw_response_wrapper( operations.bulk_delete, ) @@ -629,6 +766,9 @@ def __init__(self, operations: AsyncOperationsResource) -> None: self.delete = async_to_raw_response_wrapper( operations.delete, ) + self.bulk_create = async_to_raw_response_wrapper( + operations.bulk_create, + ) self.bulk_delete = async_to_raw_response_wrapper( operations.bulk_delete, ) @@ -654,6 +794,9 @@ def __init__(self, operations: OperationsResource) -> None: self.delete = to_streamed_response_wrapper( operations.delete, ) + self.bulk_create = to_streamed_response_wrapper( + operations.bulk_create, + ) self.bulk_delete = to_streamed_response_wrapper( operations.bulk_delete, ) @@ -679,6 +822,9 @@ def __init__(self, operations: AsyncOperationsResource) -> None: self.delete = async_to_streamed_response_wrapper( operations.delete, ) + self.bulk_create = async_to_streamed_response_wrapper( + operations.bulk_create, + ) self.bulk_delete = async_to_streamed_response_wrapper( operations.bulk_delete, ) diff --git a/src/cloudflare/resources/argo/tiered_caching.py b/src/cloudflare/resources/argo/tiered_caching.py index 46fb96c1e31..066b5a75b53 100644 --- a/src/cloudflare/resources/argo/tiered_caching.py +++ b/src/cloudflare/resources/argo/tiered_caching.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -60,9 +60,19 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TieredCachingEditResponse: + ) -> Optional[TieredCachingEditResponse]: """ - Updates enablement of Tiered Caching + Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of + lower-tiers and upper-tiers. If content is not cached in lower-tier data centers + (generally the ones closest to a visitor), the lower-tier must ask an upper-tier + to see if it has the content. If the upper-tier does not have the content, only + the upper-tier can ask the origin for content. This practice improves bandwidth + efficiency by limiting the number of data centers that can ask the origin for + content, which reduces origin load and makes websites more cost-effective to + operate. Additionally, Tiered Cache concentrates connections to origin servers + so they come from a small number of data centers rather than the full set of + network locations. This results in fewer open connections using server + resources. Args: zone_id: Identifier @@ -87,9 +97,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[TieredCachingEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[TieredCachingEditResponse]]._unwrapper, ), - cast_to=cast(Type[TieredCachingEditResponse], ResultWrapper[TieredCachingEditResponse]), + cast_to=cast(Type[Optional[TieredCachingEditResponse]], ResultWrapper[TieredCachingEditResponse]), ) def get( @@ -102,9 +112,19 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TieredCachingGetResponse: + ) -> Optional[TieredCachingGetResponse]: """ - Get Tiered Caching setting + Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of + lower-tiers and upper-tiers. If content is not cached in lower-tier data centers + (generally the ones closest to a visitor), the lower-tier must ask an upper-tier + to see if it has the content. If the upper-tier does not have the content, only + the upper-tier can ask the origin for content. This practice improves bandwidth + efficiency by limiting the number of data centers that can ask the origin for + content, which reduces origin load and makes websites more cost-effective to + operate. Additionally, Tiered Cache concentrates connections to origin servers + so they come from a small number of data centers rather than the full set of + network locations. This results in fewer open connections using server + resources. Args: zone_id: Identifier @@ -126,9 +146,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[TieredCachingGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[TieredCachingGetResponse]]._unwrapper, ), - cast_to=cast(Type[TieredCachingGetResponse], ResultWrapper[TieredCachingGetResponse]), + cast_to=cast(Type[Optional[TieredCachingGetResponse]], ResultWrapper[TieredCachingGetResponse]), ) @@ -163,9 +183,19 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TieredCachingEditResponse: + ) -> Optional[TieredCachingEditResponse]: """ - Updates enablement of Tiered Caching + Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of + lower-tiers and upper-tiers. If content is not cached in lower-tier data centers + (generally the ones closest to a visitor), the lower-tier must ask an upper-tier + to see if it has the content. If the upper-tier does not have the content, only + the upper-tier can ask the origin for content. This practice improves bandwidth + efficiency by limiting the number of data centers that can ask the origin for + content, which reduces origin load and makes websites more cost-effective to + operate. Additionally, Tiered Cache concentrates connections to origin servers + so they come from a small number of data centers rather than the full set of + network locations. This results in fewer open connections using server + resources. Args: zone_id: Identifier @@ -190,9 +220,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[TieredCachingEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[TieredCachingEditResponse]]._unwrapper, ), - cast_to=cast(Type[TieredCachingEditResponse], ResultWrapper[TieredCachingEditResponse]), + cast_to=cast(Type[Optional[TieredCachingEditResponse]], ResultWrapper[TieredCachingEditResponse]), ) async def get( @@ -205,9 +235,19 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TieredCachingGetResponse: + ) -> Optional[TieredCachingGetResponse]: """ - Get Tiered Caching setting + Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of + lower-tiers and upper-tiers. If content is not cached in lower-tier data centers + (generally the ones closest to a visitor), the lower-tier must ask an upper-tier + to see if it has the content. If the upper-tier does not have the content, only + the upper-tier can ask the origin for content. This practice improves bandwidth + efficiency by limiting the number of data centers that can ask the origin for + content, which reduces origin load and makes websites more cost-effective to + operate. Additionally, Tiered Cache concentrates connections to origin servers + so they come from a small number of data centers rather than the full set of + network locations. This results in fewer open connections using server + resources. Args: zone_id: Identifier @@ -229,9 +269,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[TieredCachingGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[TieredCachingGetResponse]]._unwrapper, ), - cast_to=cast(Type[TieredCachingGetResponse], ResultWrapper[TieredCachingGetResponse]), + cast_to=cast(Type[Optional[TieredCachingGetResponse]], ResultWrapper[TieredCachingGetResponse]), ) diff --git a/src/cloudflare/resources/cache/cache_reserve.py b/src/cloudflare/resources/cache/cache_reserve.py index 9116ecc0307..df5c9f28ccf 100644 --- a/src/cloudflare/resources/cache/cache_reserve.py +++ b/src/cloudflare/resources/cache/cache_reserve.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -62,7 +62,7 @@ def clear( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheReserveClearResponse: + ) -> Optional[CacheReserveClearResponse]: """ You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. @@ -90,9 +90,9 @@ def clear( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheReserveClearResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CacheReserveClearResponse]]._unwrapper, ), - cast_to=cast(Type[CacheReserveClearResponse], ResultWrapper[CacheReserveClearResponse]), + cast_to=cast(Type[Optional[CacheReserveClearResponse]], ResultWrapper[CacheReserveClearResponse]), ) def edit( @@ -106,7 +106,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheReserveEditResponse: + ) -> Optional[CacheReserveEditResponse]: """ Increase cache lifetimes by automatically storing all cacheable files into Cloudflare's persistent object storage buckets. Requires Cache Reserve @@ -138,9 +138,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheReserveEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CacheReserveEditResponse]]._unwrapper, ), - cast_to=cast(Type[CacheReserveEditResponse], ResultWrapper[CacheReserveEditResponse]), + cast_to=cast(Type[Optional[CacheReserveEditResponse]], ResultWrapper[CacheReserveEditResponse]), ) def get( @@ -153,7 +153,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheReserveGetResponse: + ) -> Optional[CacheReserveGetResponse]: """ Increase cache lifetimes by automatically storing all cacheable files into Cloudflare's persistent object storage buckets. Requires Cache Reserve @@ -182,9 +182,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheReserveGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CacheReserveGetResponse]]._unwrapper, ), - cast_to=cast(Type[CacheReserveGetResponse], ResultWrapper[CacheReserveGetResponse]), + cast_to=cast(Type[Optional[CacheReserveGetResponse]], ResultWrapper[CacheReserveGetResponse]), ) def status( @@ -197,7 +197,7 @@ def status( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheReserveStatusResponse: + ) -> Optional[CacheReserveStatusResponse]: """ You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. @@ -224,9 +224,9 @@ def status( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheReserveStatusResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CacheReserveStatusResponse]]._unwrapper, ), - cast_to=cast(Type[CacheReserveStatusResponse], ResultWrapper[CacheReserveStatusResponse]), + cast_to=cast(Type[Optional[CacheReserveStatusResponse]], ResultWrapper[CacheReserveStatusResponse]), ) @@ -261,7 +261,7 @@ async def clear( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheReserveClearResponse: + ) -> Optional[CacheReserveClearResponse]: """ You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. @@ -289,9 +289,9 @@ async def clear( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheReserveClearResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CacheReserveClearResponse]]._unwrapper, ), - cast_to=cast(Type[CacheReserveClearResponse], ResultWrapper[CacheReserveClearResponse]), + cast_to=cast(Type[Optional[CacheReserveClearResponse]], ResultWrapper[CacheReserveClearResponse]), ) async def edit( @@ -305,7 +305,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheReserveEditResponse: + ) -> Optional[CacheReserveEditResponse]: """ Increase cache lifetimes by automatically storing all cacheable files into Cloudflare's persistent object storage buckets. Requires Cache Reserve @@ -337,9 +337,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheReserveEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CacheReserveEditResponse]]._unwrapper, ), - cast_to=cast(Type[CacheReserveEditResponse], ResultWrapper[CacheReserveEditResponse]), + cast_to=cast(Type[Optional[CacheReserveEditResponse]], ResultWrapper[CacheReserveEditResponse]), ) async def get( @@ -352,7 +352,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheReserveGetResponse: + ) -> Optional[CacheReserveGetResponse]: """ Increase cache lifetimes by automatically storing all cacheable files into Cloudflare's persistent object storage buckets. Requires Cache Reserve @@ -381,9 +381,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheReserveGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CacheReserveGetResponse]]._unwrapper, ), - cast_to=cast(Type[CacheReserveGetResponse], ResultWrapper[CacheReserveGetResponse]), + cast_to=cast(Type[Optional[CacheReserveGetResponse]], ResultWrapper[CacheReserveGetResponse]), ) async def status( @@ -396,7 +396,7 @@ async def status( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheReserveStatusResponse: + ) -> Optional[CacheReserveStatusResponse]: """ You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. @@ -423,9 +423,9 @@ async def status( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheReserveStatusResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CacheReserveStatusResponse]]._unwrapper, ), - cast_to=cast(Type[CacheReserveStatusResponse], ResultWrapper[CacheReserveStatusResponse]), + cast_to=cast(Type[Optional[CacheReserveStatusResponse]], ResultWrapper[CacheReserveStatusResponse]), ) diff --git a/src/cloudflare/resources/cache/regional_tiered_cache.py b/src/cloudflare/resources/cache/regional_tiered_cache.py index e2d101b0154..69889f46644 100644 --- a/src/cloudflare/resources/cache/regional_tiered_cache.py +++ b/src/cloudflare/resources/cache/regional_tiered_cache.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -60,7 +60,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RegionalTieredCacheEditResponse: + ) -> Optional[RegionalTieredCacheEditResponse]: """ Instructs Cloudflare to check a regional hub data center on the way to your upper tier. This can help improve performance for smart and custom tiered cache @@ -89,9 +89,11 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RegionalTieredCacheEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[RegionalTieredCacheEditResponse]]._unwrapper, + ), + cast_to=cast( + Type[Optional[RegionalTieredCacheEditResponse]], ResultWrapper[RegionalTieredCacheEditResponse] ), - cast_to=cast(Type[RegionalTieredCacheEditResponse], ResultWrapper[RegionalTieredCacheEditResponse]), ) def get( @@ -104,7 +106,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RegionalTieredCacheGetResponse: + ) -> Optional[RegionalTieredCacheGetResponse]: """ Instructs Cloudflare to check a regional hub data center on the way to your upper tier. This can help improve performance for smart and custom tiered cache @@ -130,9 +132,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RegionalTieredCacheGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[RegionalTieredCacheGetResponse]]._unwrapper, ), - cast_to=cast(Type[RegionalTieredCacheGetResponse], ResultWrapper[RegionalTieredCacheGetResponse]), + cast_to=cast(Type[Optional[RegionalTieredCacheGetResponse]], ResultWrapper[RegionalTieredCacheGetResponse]), ) @@ -167,7 +169,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RegionalTieredCacheEditResponse: + ) -> Optional[RegionalTieredCacheEditResponse]: """ Instructs Cloudflare to check a regional hub data center on the way to your upper tier. This can help improve performance for smart and custom tiered cache @@ -198,9 +200,11 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RegionalTieredCacheEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[RegionalTieredCacheEditResponse]]._unwrapper, + ), + cast_to=cast( + Type[Optional[RegionalTieredCacheEditResponse]], ResultWrapper[RegionalTieredCacheEditResponse] ), - cast_to=cast(Type[RegionalTieredCacheEditResponse], ResultWrapper[RegionalTieredCacheEditResponse]), ) async def get( @@ -213,7 +217,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RegionalTieredCacheGetResponse: + ) -> Optional[RegionalTieredCacheGetResponse]: """ Instructs Cloudflare to check a regional hub data center on the way to your upper tier. This can help improve performance for smart and custom tiered cache @@ -239,9 +243,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RegionalTieredCacheGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[RegionalTieredCacheGetResponse]]._unwrapper, ), - cast_to=cast(Type[RegionalTieredCacheGetResponse], ResultWrapper[RegionalTieredCacheGetResponse]), + cast_to=cast(Type[Optional[RegionalTieredCacheGetResponse]], ResultWrapper[RegionalTieredCacheGetResponse]), ) diff --git a/src/cloudflare/resources/cache/smart_tiered_cache.py b/src/cloudflare/resources/cache/smart_tiered_cache.py index abd3127ed38..93a2f3510cf 100644 --- a/src/cloudflare/resources/cache/smart_tiered_cache.py +++ b/src/cloudflare/resources/cache/smart_tiered_cache.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -60,9 +60,14 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SmartTieredCacheDeleteResponse: + ) -> Optional[SmartTieredCacheDeleteResponse]: """ - Remvoves enablement of Smart Tiered Cache + Smart Tiered Cache dynamically selects the single closest upper tier for each of + your website’s origins with no configuration required, using our in-house + performance and routing data. Cloudflare collects latency data for each request + to an origin, and uses the latency data to determine how well any upper-tier + data center is connected with an origin. As a result, Cloudflare can select the + data center with the lowest latency to be the upper-tier for an origin. Args: zone_id: Identifier @@ -84,9 +89,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SmartTieredCacheDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[SmartTieredCacheDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[SmartTieredCacheDeleteResponse], ResultWrapper[SmartTieredCacheDeleteResponse]), + cast_to=cast(Type[Optional[SmartTieredCacheDeleteResponse]], ResultWrapper[SmartTieredCacheDeleteResponse]), ) def edit( @@ -100,9 +105,14 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SmartTieredCacheEditResponse: + ) -> Optional[SmartTieredCacheEditResponse]: """ - Updates enablement of Tiered Cache + Smart Tiered Cache dynamically selects the single closest upper tier for each of + your website’s origins with no configuration required, using our in-house + performance and routing data. Cloudflare collects latency data for each request + to an origin, and uses the latency data to determine how well any upper-tier + data center is connected with an origin. As a result, Cloudflare can select the + data center with the lowest latency to be the upper-tier for an origin. Args: zone_id: Identifier @@ -127,9 +137,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SmartTieredCacheEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[SmartTieredCacheEditResponse]]._unwrapper, ), - cast_to=cast(Type[SmartTieredCacheEditResponse], ResultWrapper[SmartTieredCacheEditResponse]), + cast_to=cast(Type[Optional[SmartTieredCacheEditResponse]], ResultWrapper[SmartTieredCacheEditResponse]), ) def get( @@ -142,9 +152,14 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SmartTieredCacheGetResponse: + ) -> Optional[SmartTieredCacheGetResponse]: """ - Get Smart Tiered Cache setting + Smart Tiered Cache dynamically selects the single closest upper tier for each of + your website’s origins with no configuration required, using our in-house + performance and routing data. Cloudflare collects latency data for each request + to an origin, and uses the latency data to determine how well any upper-tier + data center is connected with an origin. As a result, Cloudflare can select the + data center with the lowest latency to be the upper-tier for an origin. Args: zone_id: Identifier @@ -166,9 +181,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SmartTieredCacheGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[SmartTieredCacheGetResponse]]._unwrapper, ), - cast_to=cast(Type[SmartTieredCacheGetResponse], ResultWrapper[SmartTieredCacheGetResponse]), + cast_to=cast(Type[Optional[SmartTieredCacheGetResponse]], ResultWrapper[SmartTieredCacheGetResponse]), ) @@ -202,9 +217,14 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SmartTieredCacheDeleteResponse: + ) -> Optional[SmartTieredCacheDeleteResponse]: """ - Remvoves enablement of Smart Tiered Cache + Smart Tiered Cache dynamically selects the single closest upper tier for each of + your website’s origins with no configuration required, using our in-house + performance and routing data. Cloudflare collects latency data for each request + to an origin, and uses the latency data to determine how well any upper-tier + data center is connected with an origin. As a result, Cloudflare can select the + data center with the lowest latency to be the upper-tier for an origin. Args: zone_id: Identifier @@ -226,9 +246,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SmartTieredCacheDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[SmartTieredCacheDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[SmartTieredCacheDeleteResponse], ResultWrapper[SmartTieredCacheDeleteResponse]), + cast_to=cast(Type[Optional[SmartTieredCacheDeleteResponse]], ResultWrapper[SmartTieredCacheDeleteResponse]), ) async def edit( @@ -242,9 +262,14 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SmartTieredCacheEditResponse: + ) -> Optional[SmartTieredCacheEditResponse]: """ - Updates enablement of Tiered Cache + Smart Tiered Cache dynamically selects the single closest upper tier for each of + your website’s origins with no configuration required, using our in-house + performance and routing data. Cloudflare collects latency data for each request + to an origin, and uses the latency data to determine how well any upper-tier + data center is connected with an origin. As a result, Cloudflare can select the + data center with the lowest latency to be the upper-tier for an origin. Args: zone_id: Identifier @@ -271,9 +296,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SmartTieredCacheEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[SmartTieredCacheEditResponse]]._unwrapper, ), - cast_to=cast(Type[SmartTieredCacheEditResponse], ResultWrapper[SmartTieredCacheEditResponse]), + cast_to=cast(Type[Optional[SmartTieredCacheEditResponse]], ResultWrapper[SmartTieredCacheEditResponse]), ) async def get( @@ -286,9 +311,14 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SmartTieredCacheGetResponse: + ) -> Optional[SmartTieredCacheGetResponse]: """ - Get Smart Tiered Cache setting + Smart Tiered Cache dynamically selects the single closest upper tier for each of + your website’s origins with no configuration required, using our in-house + performance and routing data. Cloudflare collects latency data for each request + to an origin, and uses the latency data to determine how well any upper-tier + data center is connected with an origin. As a result, Cloudflare can select the + data center with the lowest latency to be the upper-tier for an origin. Args: zone_id: Identifier @@ -310,9 +340,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SmartTieredCacheGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[SmartTieredCacheGetResponse]]._unwrapper, ), - cast_to=cast(Type[SmartTieredCacheGetResponse], ResultWrapper[SmartTieredCacheGetResponse]), + cast_to=cast(Type[Optional[SmartTieredCacheGetResponse]], ResultWrapper[SmartTieredCacheGetResponse]), ) diff --git a/src/cloudflare/resources/cache/variants.py b/src/cloudflare/resources/cache/variants.py index 254dbf3eb20..04b84159e3b 100644 --- a/src/cloudflare/resources/cache/variants.py +++ b/src/cloudflare/resources/cache/variants.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -22,9 +22,9 @@ from ..._wrappers import ResultWrapper from ...types.cache import variant_edit_params from ..._base_client import make_request_options -from ...types.cache.cache_variant import CacheVariant from ...types.cache.variant_get_response import VariantGetResponse from ...types.cache.variant_edit_response import VariantEditResponse +from ...types.cache.variant_delete_response import VariantDeleteResponse __all__ = ["VariantsResource", "AsyncVariantsResource"] @@ -59,7 +59,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheVariant: + ) -> Optional[VariantDeleteResponse]: """ Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the @@ -87,9 +87,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheVariant]._unwrapper, + post_parser=ResultWrapper[Optional[VariantDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[CacheVariant], ResultWrapper[CacheVariant]), + cast_to=cast(Type[Optional[VariantDeleteResponse]], ResultWrapper[VariantDeleteResponse]), ) def edit( @@ -103,7 +103,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VariantEditResponse: + ) -> Optional[VariantEditResponse]: """ Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the @@ -134,9 +134,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[VariantEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[VariantEditResponse]]._unwrapper, ), - cast_to=cast(Type[VariantEditResponse], ResultWrapper[VariantEditResponse]), + cast_to=cast(Type[Optional[VariantEditResponse]], ResultWrapper[VariantEditResponse]), ) def get( @@ -149,7 +149,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VariantGetResponse: + ) -> Optional[VariantGetResponse]: """ Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the @@ -177,9 +177,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[VariantGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[VariantGetResponse]]._unwrapper, ), - cast_to=cast(Type[VariantGetResponse], ResultWrapper[VariantGetResponse]), + cast_to=cast(Type[Optional[VariantGetResponse]], ResultWrapper[VariantGetResponse]), ) @@ -213,7 +213,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheVariant: + ) -> Optional[VariantDeleteResponse]: """ Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the @@ -241,9 +241,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheVariant]._unwrapper, + post_parser=ResultWrapper[Optional[VariantDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[CacheVariant], ResultWrapper[CacheVariant]), + cast_to=cast(Type[Optional[VariantDeleteResponse]], ResultWrapper[VariantDeleteResponse]), ) async def edit( @@ -257,7 +257,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VariantEditResponse: + ) -> Optional[VariantEditResponse]: """ Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the @@ -288,9 +288,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[VariantEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[VariantEditResponse]]._unwrapper, ), - cast_to=cast(Type[VariantEditResponse], ResultWrapper[VariantEditResponse]), + cast_to=cast(Type[Optional[VariantEditResponse]], ResultWrapper[VariantEditResponse]), ) async def get( @@ -303,7 +303,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VariantGetResponse: + ) -> Optional[VariantGetResponse]: """ Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the @@ -331,9 +331,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[VariantGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[VariantGetResponse]]._unwrapper, ), - cast_to=cast(Type[VariantGetResponse], ResultWrapper[VariantGetResponse]), + cast_to=cast(Type[Optional[VariantGetResponse]], ResultWrapper[VariantGetResponse]), ) diff --git a/src/cloudflare/resources/cloud_connector/rules.py b/src/cloudflare/resources/cloud_connector/rules.py index 2a80d122319..d067255d0ee 100644 --- a/src/cloudflare/resources/cloud_connector/rules.py +++ b/src/cloudflare/resources/cloud_connector/rules.py @@ -53,7 +53,7 @@ def update( self, *, zone_id: str, - body: Iterable[rule_update_params.Body], + rules: Iterable[rule_update_params.Rule], # 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, @@ -67,7 +67,7 @@ def update( Args: zone_id: Identifier - body: List of Cloud Connector rules + rules: List of Cloud Connector rules extra_headers: Send extra headers @@ -81,7 +81,7 @@ def update( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return self._put( f"/zones/{zone_id}/cloud_connector/rules", - body=maybe_transform(body, Iterable[rule_update_params.Body]), + body=maybe_transform(rules, Iterable[rule_update_params.Rule]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -153,7 +153,7 @@ async def update( self, *, zone_id: str, - body: Iterable[rule_update_params.Body], + rules: Iterable[rule_update_params.Rule], # 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, @@ -167,7 +167,7 @@ async def update( Args: zone_id: Identifier - body: List of Cloud Connector rules + rules: List of Cloud Connector rules extra_headers: Send extra headers @@ -181,7 +181,7 @@ async def update( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return await self._put( f"/zones/{zone_id}/cloud_connector/rules", - body=await async_maybe_transform(body, Iterable[rule_update_params.Body]), + body=await async_maybe_transform(rules, Iterable[rule_update_params.Rule]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/dns/records.py b/src/cloudflare/resources/dns/records.py index 9ef6762d58f..61a0e3e043d 100644 --- a/src/cloudflare/resources/dns/records.py +++ b/src/cloudflare/resources/dns/records.py @@ -36,16 +36,14 @@ from ...types.dns.ttl_param import TTLParam from ...types.dns.record_tags import RecordTags from ...types.dns.record_param import RecordParam +from ...types.dns.batch_put_param import BatchPutParam +from ...types.dns.record_response import RecordResponse +from ...types.dns.batch_patch_param import BatchPatchParam from ...types.shared.sort_direction import SortDirection -from ...types.dns.record_get_response import RecordGetResponse -from ...types.dns.record_edit_response import RecordEditResponse -from ...types.dns.record_list_response import RecordListResponse from ...types.dns.record_scan_response import RecordScanResponse from ...types.dns.record_batch_response import RecordBatchResponse -from ...types.dns.record_create_response import RecordCreateResponse from ...types.dns.record_delete_response import RecordDeleteResponse from ...types.dns.record_import_response import RecordImportResponse -from ...types.dns.record_update_response import RecordUpdateResponse __all__ = ["RecordsResource", "AsyncRecordsResource"] @@ -79,6 +77,7 @@ def create( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.ARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["A"] | NotGiven = NOT_GIVEN, @@ -88,7 +87,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -112,6 +111,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -139,6 +140,7 @@ def create( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.AAAARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["AAAA"] | NotGiven = NOT_GIVEN, @@ -148,7 +150,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -172,6 +174,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -199,6 +203,7 @@ def create( data: record_create_params.CAARecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.CAARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["CAA"] | NotGiven = NOT_GIVEN, @@ -208,7 +213,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -232,6 +237,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -259,6 +266,7 @@ def create( data: record_create_params.CERTRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.CERTRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["CERT"] | NotGiven = NOT_GIVEN, @@ -268,7 +276,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -292,6 +300,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -329,7 +339,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -353,6 +363,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -380,6 +392,7 @@ def create( data: record_create_params.DNSKEYRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.DNSKEYRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["DNSKEY"] | NotGiven = NOT_GIVEN, @@ -389,7 +402,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -413,6 +426,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -440,6 +455,7 @@ def create( data: record_create_params.DSRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.DSRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["DS"] | NotGiven = NOT_GIVEN, @@ -449,7 +465,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -473,6 +489,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -500,6 +518,7 @@ def create( data: record_create_params.HTTPSRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.HTTPSRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["HTTPS"] | NotGiven = NOT_GIVEN, @@ -509,7 +528,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -533,6 +552,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -560,6 +581,7 @@ def create( data: record_create_params.LOCRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.LOCRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["LOC"] | NotGiven = NOT_GIVEN, @@ -569,7 +591,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -593,6 +615,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -621,6 +645,7 @@ def create( name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.MXRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["MX"] | NotGiven = NOT_GIVEN, @@ -630,7 +655,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -657,6 +682,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -684,6 +711,7 @@ def create( data: record_create_params.NAPTRRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.NAPTRRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["NAPTR"] | NotGiven = NOT_GIVEN, @@ -693,7 +721,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -717,6 +745,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -744,6 +774,7 @@ def create( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.NSRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["NS"] | NotGiven = NOT_GIVEN, @@ -753,7 +784,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -777,6 +808,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -804,6 +837,7 @@ def create( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.DNSRecordsOpenpgpkeyRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["OPENPGPKEY"] | NotGiven = NOT_GIVEN, @@ -813,7 +847,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -837,6 +871,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -864,6 +900,7 @@ def create( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.PTRRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["PTR"] | NotGiven = NOT_GIVEN, @@ -873,7 +910,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -897,6 +934,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -924,6 +963,7 @@ def create( data: record_create_params.SMIMEARecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.SMIMEARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SMIMEA"] | NotGiven = NOT_GIVEN, @@ -933,7 +973,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -957,6 +997,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -984,6 +1026,7 @@ def create( data: record_create_params.SRVRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.SRVRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SRV"] | NotGiven = NOT_GIVEN, @@ -993,7 +1036,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -1017,6 +1060,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -1044,6 +1089,7 @@ def create( data: record_create_params.SSHFPRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.SSHFPRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SSHFP"] | NotGiven = NOT_GIVEN, @@ -1053,7 +1099,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -1077,6 +1123,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -1104,6 +1152,7 @@ def create( data: record_create_params.SVCBRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.SVCBRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SVCB"] | NotGiven = NOT_GIVEN, @@ -1113,7 +1162,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -1137,6 +1186,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -1164,6 +1215,7 @@ def create( data: record_create_params.TLSARecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.TLSARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["TLSA"] | NotGiven = NOT_GIVEN, @@ -1173,7 +1225,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -1197,6 +1249,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -1224,6 +1278,7 @@ def create( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.TXTRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["TXT"] | NotGiven = NOT_GIVEN, @@ -1233,7 +1288,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -1262,6 +1317,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -1290,6 +1347,7 @@ def create( name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.URIRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["URI"] | NotGiven = NOT_GIVEN, @@ -1299,7 +1357,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -1326,6 +1384,8 @@ def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -1353,6 +1413,9 @@ def create( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.ARecordSettings + | record_create_params.CNAMERecordSettings + | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["A"] @@ -1389,7 +1452,6 @@ def create( | record_create_params.SSHFPRecordData | record_create_params.URIRecordData | NotGiven = NOT_GIVEN, - settings: record_create_params.CNAMERecordSettings | NotGiven = NOT_GIVEN, priority: float | 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. @@ -1397,11 +1459,11 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return cast( - Optional[RecordCreateResponse], + Optional[RecordResponse], self._post( f"/zones/{zone_id}/dns_records", body=maybe_transform( @@ -1410,11 +1472,11 @@ def create( "content": content, "name": name, "proxied": proxied, + "settings": settings, "tags": tags, "ttl": ttl, "type": type, "data": data, - "settings": settings, "priority": priority, }, record_create_params.RecordCreateParams, @@ -1424,10 +1486,10 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[RecordCreateResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[RecordResponse]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[RecordCreateResponse] + Any, ResultWrapper[RecordResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -1442,6 +1504,7 @@ def update( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.ARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["A"] | NotGiven = NOT_GIVEN, @@ -1451,7 +1514,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -1477,6 +1540,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -1505,6 +1570,7 @@ def update( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.AAAARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["AAAA"] | NotGiven = NOT_GIVEN, @@ -1514,7 +1580,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -1540,6 +1606,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -1568,6 +1636,7 @@ def update( data: record_update_params.CAARecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.CAARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["CAA"] | NotGiven = NOT_GIVEN, @@ -1577,7 +1646,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -1603,6 +1672,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -1631,6 +1702,7 @@ def update( data: record_update_params.CERTRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.CERTRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["CERT"] | NotGiven = NOT_GIVEN, @@ -1640,7 +1712,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -1666,6 +1738,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -1704,7 +1778,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -1730,6 +1804,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -1758,6 +1834,7 @@ def update( data: record_update_params.DNSKEYRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.DNSKEYRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["DNSKEY"] | NotGiven = NOT_GIVEN, @@ -1767,7 +1844,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -1793,6 +1870,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -1821,6 +1900,7 @@ def update( data: record_update_params.DSRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.DSRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["DS"] | NotGiven = NOT_GIVEN, @@ -1830,7 +1910,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -1856,6 +1936,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -1884,6 +1966,7 @@ def update( data: record_update_params.HTTPSRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.HTTPSRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["HTTPS"] | NotGiven = NOT_GIVEN, @@ -1893,7 +1976,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -1919,6 +2002,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -1947,6 +2032,7 @@ def update( data: record_update_params.LOCRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.LOCRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["LOC"] | NotGiven = NOT_GIVEN, @@ -1956,7 +2042,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -1982,6 +2068,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -2011,6 +2099,7 @@ def update( name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.MXRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["MX"] | NotGiven = NOT_GIVEN, @@ -2020,7 +2109,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -2049,6 +2138,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -2077,6 +2168,7 @@ def update( data: record_update_params.NAPTRRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.NAPTRRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["NAPTR"] | NotGiven = NOT_GIVEN, @@ -2086,7 +2178,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -2112,6 +2204,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -2140,6 +2234,7 @@ def update( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.NSRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["NS"] | NotGiven = NOT_GIVEN, @@ -2149,7 +2244,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -2175,6 +2270,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -2203,6 +2300,7 @@ def update( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.DNSRecordsOpenpgpkeyRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["OPENPGPKEY"] | NotGiven = NOT_GIVEN, @@ -2212,7 +2310,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -2238,6 +2336,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -2266,6 +2366,7 @@ def update( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.PTRRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["PTR"] | NotGiven = NOT_GIVEN, @@ -2275,7 +2376,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -2301,6 +2402,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -2329,6 +2432,7 @@ def update( data: record_update_params.SMIMEARecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.SMIMEARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SMIMEA"] | NotGiven = NOT_GIVEN, @@ -2338,7 +2442,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -2364,6 +2468,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -2392,6 +2498,7 @@ def update( data: record_update_params.SRVRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.SRVRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SRV"] | NotGiven = NOT_GIVEN, @@ -2401,7 +2508,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -2427,6 +2534,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -2455,6 +2564,7 @@ def update( data: record_update_params.SSHFPRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.SSHFPRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SSHFP"] | NotGiven = NOT_GIVEN, @@ -2464,7 +2574,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -2490,6 +2600,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -2518,6 +2630,7 @@ def update( data: record_update_params.SVCBRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.SVCBRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SVCB"] | NotGiven = NOT_GIVEN, @@ -2527,7 +2640,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -2553,6 +2666,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -2581,6 +2696,7 @@ def update( data: record_update_params.TLSARecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.TLSARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["TLSA"] | NotGiven = NOT_GIVEN, @@ -2590,7 +2706,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -2616,6 +2732,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -2644,6 +2762,7 @@ def update( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.TXTRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["TXT"] | NotGiven = NOT_GIVEN, @@ -2653,7 +2772,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -2684,6 +2803,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -2713,6 +2834,7 @@ def update( name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.URIRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["URI"] | NotGiven = NOT_GIVEN, @@ -2722,7 +2844,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -2751,6 +2873,8 @@ def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -2779,6 +2903,9 @@ def update( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.ARecordSettings + | record_update_params.CNAMERecordSettings + | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["A"] @@ -2815,7 +2942,6 @@ def update( | record_update_params.SSHFPRecordData | record_update_params.URIRecordData | NotGiven = NOT_GIVEN, - settings: record_update_params.CNAMERecordSettings | NotGiven = NOT_GIVEN, priority: float | 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. @@ -2823,13 +2949,13 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not dns_record_id: raise ValueError(f"Expected a non-empty value for `dns_record_id` but received {dns_record_id!r}") return cast( - Optional[RecordUpdateResponse], + Optional[RecordResponse], self._put( f"/zones/{zone_id}/dns_records/{dns_record_id}", body=maybe_transform( @@ -2838,11 +2964,11 @@ def update( "content": content, "name": name, "proxied": proxied, + "settings": settings, "tags": tags, "ttl": ttl, "type": type, "data": data, - "settings": settings, "priority": priority, }, record_update_params.RecordUpdateParams, @@ -2852,10 +2978,10 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[RecordUpdateResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[RecordResponse]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[RecordUpdateResponse] + Any, ResultWrapper[RecordResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -2906,7 +3032,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[RecordListResponse]: + ) -> SyncV4PagePaginationArray[RecordResponse]: """ List, search, sort, and filter a zones' DNS records. @@ -2954,7 +3080,7 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return self._get_api_list( f"/zones/{zone_id}/dns_records", - page=SyncV4PagePaginationArray[RecordListResponse], + page=SyncV4PagePaginationArray[RecordResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2979,7 +3105,7 @@ def list( record_list_params.RecordListParams, ), ), - model=cast(Any, RecordListResponse), # Union types cannot be passed in as arguments in the type system + model=cast(Any, RecordResponse), # Union types cannot be passed in as arguments in the type system ) def delete( @@ -3031,9 +3157,9 @@ def batch( *, zone_id: str, deletes: Iterable[record_batch_params.Delete] | NotGiven = NOT_GIVEN, - patches: Iterable[record_batch_params.Patch] | NotGiven = NOT_GIVEN, + patches: Iterable[BatchPatchParam] | NotGiven = NOT_GIVEN, posts: Iterable[RecordParam] | NotGiven = NOT_GIVEN, - puts: Iterable[record_batch_params.Put] | NotGiven = NOT_GIVEN, + puts: Iterable[BatchPutParam] | 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, @@ -3104,6 +3230,7 @@ def edit( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.ARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["A"] | NotGiven = NOT_GIVEN, @@ -3113,7 +3240,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -3139,6 +3266,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -3167,6 +3296,7 @@ def edit( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.AAAARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["AAAA"] | NotGiven = NOT_GIVEN, @@ -3176,7 +3306,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -3202,6 +3332,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -3230,6 +3362,7 @@ def edit( data: record_edit_params.CAARecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.CAARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["CAA"] | NotGiven = NOT_GIVEN, @@ -3239,7 +3372,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -3265,6 +3398,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -3293,6 +3428,7 @@ def edit( data: record_edit_params.CERTRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.CERTRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["CERT"] | NotGiven = NOT_GIVEN, @@ -3302,7 +3438,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -3328,6 +3464,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -3366,7 +3504,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -3392,6 +3530,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -3420,6 +3560,7 @@ def edit( data: record_edit_params.DNSKEYRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.DNSKEYRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["DNSKEY"] | NotGiven = NOT_GIVEN, @@ -3429,7 +3570,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -3455,6 +3596,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -3483,6 +3626,7 @@ def edit( data: record_edit_params.DSRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.DSRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["DS"] | NotGiven = NOT_GIVEN, @@ -3492,7 +3636,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -3518,6 +3662,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -3546,6 +3692,7 @@ def edit( data: record_edit_params.HTTPSRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.HTTPSRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["HTTPS"] | NotGiven = NOT_GIVEN, @@ -3555,7 +3702,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -3581,6 +3728,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -3609,6 +3758,7 @@ def edit( data: record_edit_params.LOCRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.LOCRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["LOC"] | NotGiven = NOT_GIVEN, @@ -3618,7 +3768,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -3644,6 +3794,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -3673,6 +3825,7 @@ def edit( name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.MXRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["MX"] | NotGiven = NOT_GIVEN, @@ -3682,7 +3835,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -3711,6 +3864,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -3739,6 +3894,7 @@ def edit( data: record_edit_params.NAPTRRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.NAPTRRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["NAPTR"] | NotGiven = NOT_GIVEN, @@ -3748,7 +3904,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -3774,6 +3930,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -3802,6 +3960,7 @@ def edit( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.NSRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["NS"] | NotGiven = NOT_GIVEN, @@ -3811,7 +3970,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -3837,6 +3996,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -3865,6 +4026,7 @@ def edit( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.DNSRecordsOpenpgpkeyRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["OPENPGPKEY"] | NotGiven = NOT_GIVEN, @@ -3874,7 +4036,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -3900,6 +4062,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -3928,6 +4092,7 @@ def edit( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.PTRRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["PTR"] | NotGiven = NOT_GIVEN, @@ -3937,7 +4102,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -3963,6 +4128,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -3991,6 +4158,7 @@ def edit( data: record_edit_params.SMIMEARecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.SMIMEARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SMIMEA"] | NotGiven = NOT_GIVEN, @@ -4000,7 +4168,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -4026,6 +4194,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -4054,6 +4224,7 @@ def edit( data: record_edit_params.SRVRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.SRVRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SRV"] | NotGiven = NOT_GIVEN, @@ -4063,7 +4234,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -4089,6 +4260,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -4117,6 +4290,7 @@ def edit( data: record_edit_params.SSHFPRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.SSHFPRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SSHFP"] | NotGiven = NOT_GIVEN, @@ -4126,7 +4300,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -4152,6 +4326,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -4180,6 +4356,7 @@ def edit( data: record_edit_params.SVCBRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.SVCBRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SVCB"] | NotGiven = NOT_GIVEN, @@ -4189,7 +4366,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -4215,6 +4392,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -4243,6 +4422,7 @@ def edit( data: record_edit_params.TLSARecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.TLSARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["TLSA"] | NotGiven = NOT_GIVEN, @@ -4252,7 +4432,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -4278,6 +4458,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -4306,6 +4488,7 @@ def edit( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.TXTRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["TXT"] | NotGiven = NOT_GIVEN, @@ -4315,7 +4498,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -4346,6 +4529,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -4375,6 +4560,7 @@ def edit( name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.URIRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["URI"] | NotGiven = NOT_GIVEN, @@ -4384,7 +4570,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -4413,6 +4599,8 @@ def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -4441,6 +4629,7 @@ def edit( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.ARecordSettings | record_edit_params.CNAMERecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["A"] @@ -4477,7 +4666,6 @@ def edit( | record_edit_params.SSHFPRecordData | record_edit_params.URIRecordData | NotGiven = NOT_GIVEN, - settings: record_edit_params.CNAMERecordSettings | NotGiven = NOT_GIVEN, priority: float | 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. @@ -4485,13 +4673,13 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not dns_record_id: raise ValueError(f"Expected a non-empty value for `dns_record_id` but received {dns_record_id!r}") return cast( - Optional[RecordEditResponse], + Optional[RecordResponse], self._patch( f"/zones/{zone_id}/dns_records/{dns_record_id}", body=maybe_transform( @@ -4500,11 +4688,11 @@ def edit( "content": content, "name": name, "proxied": proxied, + "settings": settings, "tags": tags, "ttl": ttl, "type": type, "data": data, - "settings": settings, "priority": priority, }, record_edit_params.RecordEditParams, @@ -4514,10 +4702,10 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[RecordEditResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[RecordResponse]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[RecordEditResponse] + Any, ResultWrapper[RecordResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -4575,7 +4763,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordGetResponse]: + ) -> Optional[RecordResponse]: """ DNS Record Details @@ -4597,7 +4785,7 @@ def get( if not dns_record_id: raise ValueError(f"Expected a non-empty value for `dns_record_id` but received {dns_record_id!r}") return cast( - Optional[RecordGetResponse], + Optional[RecordResponse], self._get( f"/zones/{zone_id}/dns_records/{dns_record_id}", options=make_request_options( @@ -4605,10 +4793,10 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[RecordGetResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[RecordResponse]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[RecordGetResponse] + Any, ResultWrapper[RecordResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -4754,6 +4942,7 @@ async def create( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.ARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["A"] | NotGiven = NOT_GIVEN, @@ -4763,7 +4952,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -4787,6 +4976,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -4814,6 +5005,7 @@ async def create( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.AAAARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["AAAA"] | NotGiven = NOT_GIVEN, @@ -4823,7 +5015,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -4847,6 +5039,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -4874,6 +5068,7 @@ async def create( data: record_create_params.CAARecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.CAARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["CAA"] | NotGiven = NOT_GIVEN, @@ -4883,7 +5078,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -4907,6 +5102,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -4934,6 +5131,7 @@ async def create( data: record_create_params.CERTRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.CERTRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["CERT"] | NotGiven = NOT_GIVEN, @@ -4943,7 +5141,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -4967,6 +5165,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -5004,7 +5204,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -5028,6 +5228,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -5055,6 +5257,7 @@ async def create( data: record_create_params.DNSKEYRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.DNSKEYRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["DNSKEY"] | NotGiven = NOT_GIVEN, @@ -5064,7 +5267,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -5088,6 +5291,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -5115,6 +5320,7 @@ async def create( data: record_create_params.DSRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.DSRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["DS"] | NotGiven = NOT_GIVEN, @@ -5124,7 +5330,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -5148,6 +5354,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -5175,6 +5383,7 @@ async def create( data: record_create_params.HTTPSRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.HTTPSRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["HTTPS"] | NotGiven = NOT_GIVEN, @@ -5184,7 +5393,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -5208,6 +5417,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -5235,6 +5446,7 @@ async def create( data: record_create_params.LOCRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.LOCRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["LOC"] | NotGiven = NOT_GIVEN, @@ -5244,7 +5456,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -5268,6 +5480,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -5296,6 +5510,7 @@ async def create( name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.MXRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["MX"] | NotGiven = NOT_GIVEN, @@ -5305,7 +5520,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -5332,6 +5547,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -5359,6 +5576,7 @@ async def create( data: record_create_params.NAPTRRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.NAPTRRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["NAPTR"] | NotGiven = NOT_GIVEN, @@ -5368,7 +5586,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -5392,6 +5610,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -5419,6 +5639,7 @@ async def create( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.NSRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["NS"] | NotGiven = NOT_GIVEN, @@ -5428,7 +5649,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -5452,6 +5673,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -5479,6 +5702,7 @@ async def create( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.DNSRecordsOpenpgpkeyRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["OPENPGPKEY"] | NotGiven = NOT_GIVEN, @@ -5488,7 +5712,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -5512,6 +5736,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -5539,6 +5765,7 @@ async def create( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.PTRRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["PTR"] | NotGiven = NOT_GIVEN, @@ -5548,7 +5775,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -5572,6 +5799,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -5599,6 +5828,7 @@ async def create( data: record_create_params.SMIMEARecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.SMIMEARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SMIMEA"] | NotGiven = NOT_GIVEN, @@ -5608,7 +5838,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -5632,6 +5862,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -5659,6 +5891,7 @@ async def create( data: record_create_params.SRVRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.SRVRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SRV"] | NotGiven = NOT_GIVEN, @@ -5668,7 +5901,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -5692,6 +5925,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -5719,6 +5954,7 @@ async def create( data: record_create_params.SSHFPRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.SSHFPRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SSHFP"] | NotGiven = NOT_GIVEN, @@ -5728,7 +5964,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -5752,6 +5988,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -5779,6 +6017,7 @@ async def create( data: record_create_params.SVCBRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.SVCBRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SVCB"] | NotGiven = NOT_GIVEN, @@ -5788,7 +6027,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -5812,6 +6051,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -5839,6 +6080,7 @@ async def create( data: record_create_params.TLSARecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.TLSARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["TLSA"] | NotGiven = NOT_GIVEN, @@ -5848,7 +6090,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -5872,6 +6114,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -5899,6 +6143,7 @@ async def create( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.TXTRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["TXT"] | NotGiven = NOT_GIVEN, @@ -5908,7 +6153,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -5937,6 +6182,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -5965,6 +6212,7 @@ async def create( name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.URIRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["URI"] | NotGiven = NOT_GIVEN, @@ -5974,7 +6222,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: """ Create a new DNS record for a zone. @@ -6001,6 +6249,8 @@ async def create( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -6028,6 +6278,9 @@ async def create( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_create_params.ARecordSettings + | record_create_params.CNAMERecordSettings + | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["A"] @@ -6064,7 +6317,6 @@ async def create( | record_create_params.SSHFPRecordData | record_create_params.URIRecordData | NotGiven = NOT_GIVEN, - settings: record_create_params.CNAMERecordSettings | NotGiven = NOT_GIVEN, priority: float | 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. @@ -6072,11 +6324,11 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordCreateResponse]: + ) -> Optional[RecordResponse]: if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return cast( - Optional[RecordCreateResponse], + Optional[RecordResponse], await self._post( f"/zones/{zone_id}/dns_records", body=await async_maybe_transform( @@ -6085,11 +6337,11 @@ async def create( "content": content, "name": name, "proxied": proxied, + "settings": settings, "tags": tags, "ttl": ttl, "type": type, "data": data, - "settings": settings, "priority": priority, }, record_create_params.RecordCreateParams, @@ -6099,10 +6351,10 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[RecordCreateResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[RecordResponse]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[RecordCreateResponse] + Any, ResultWrapper[RecordResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -6117,6 +6369,7 @@ async def update( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.ARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["A"] | NotGiven = NOT_GIVEN, @@ -6126,7 +6379,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -6152,6 +6405,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -6180,6 +6435,7 @@ async def update( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.AAAARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["AAAA"] | NotGiven = NOT_GIVEN, @@ -6189,7 +6445,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -6215,6 +6471,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -6243,6 +6501,7 @@ async def update( data: record_update_params.CAARecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.CAARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["CAA"] | NotGiven = NOT_GIVEN, @@ -6252,7 +6511,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -6278,6 +6537,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -6306,6 +6567,7 @@ async def update( data: record_update_params.CERTRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.CERTRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["CERT"] | NotGiven = NOT_GIVEN, @@ -6315,7 +6577,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -6341,6 +6603,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -6379,7 +6643,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -6405,6 +6669,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -6433,6 +6699,7 @@ async def update( data: record_update_params.DNSKEYRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.DNSKEYRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["DNSKEY"] | NotGiven = NOT_GIVEN, @@ -6442,7 +6709,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -6468,6 +6735,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -6496,6 +6765,7 @@ async def update( data: record_update_params.DSRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.DSRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["DS"] | NotGiven = NOT_GIVEN, @@ -6505,7 +6775,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -6531,6 +6801,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -6559,6 +6831,7 @@ async def update( data: record_update_params.HTTPSRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.HTTPSRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["HTTPS"] | NotGiven = NOT_GIVEN, @@ -6568,7 +6841,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -6594,6 +6867,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -6622,6 +6897,7 @@ async def update( data: record_update_params.LOCRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.LOCRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["LOC"] | NotGiven = NOT_GIVEN, @@ -6631,7 +6907,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -6657,6 +6933,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -6686,6 +6964,7 @@ async def update( name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.MXRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["MX"] | NotGiven = NOT_GIVEN, @@ -6695,7 +6974,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -6724,6 +7003,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -6752,6 +7033,7 @@ async def update( data: record_update_params.NAPTRRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.NAPTRRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["NAPTR"] | NotGiven = NOT_GIVEN, @@ -6761,7 +7043,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -6787,6 +7069,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -6815,6 +7099,7 @@ async def update( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.NSRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["NS"] | NotGiven = NOT_GIVEN, @@ -6824,7 +7109,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -6850,6 +7135,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -6878,6 +7165,7 @@ async def update( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.DNSRecordsOpenpgpkeyRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["OPENPGPKEY"] | NotGiven = NOT_GIVEN, @@ -6887,7 +7175,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -6913,6 +7201,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -6941,6 +7231,7 @@ async def update( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.PTRRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["PTR"] | NotGiven = NOT_GIVEN, @@ -6950,7 +7241,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -6976,6 +7267,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -7004,6 +7297,7 @@ async def update( data: record_update_params.SMIMEARecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.SMIMEARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SMIMEA"] | NotGiven = NOT_GIVEN, @@ -7013,7 +7307,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -7039,6 +7333,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -7067,6 +7363,7 @@ async def update( data: record_update_params.SRVRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.SRVRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SRV"] | NotGiven = NOT_GIVEN, @@ -7076,7 +7373,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -7102,6 +7399,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -7130,6 +7429,7 @@ async def update( data: record_update_params.SSHFPRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.SSHFPRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SSHFP"] | NotGiven = NOT_GIVEN, @@ -7139,7 +7439,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -7165,6 +7465,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -7193,6 +7495,7 @@ async def update( data: record_update_params.SVCBRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.SVCBRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SVCB"] | NotGiven = NOT_GIVEN, @@ -7202,7 +7505,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -7228,6 +7531,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -7256,6 +7561,7 @@ async def update( data: record_update_params.TLSARecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.TLSARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["TLSA"] | NotGiven = NOT_GIVEN, @@ -7265,7 +7571,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -7291,6 +7597,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -7319,6 +7627,7 @@ async def update( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.TXTRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["TXT"] | NotGiven = NOT_GIVEN, @@ -7328,7 +7637,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -7359,6 +7668,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -7388,6 +7699,7 @@ async def update( name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.URIRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["URI"] | NotGiven = NOT_GIVEN, @@ -7397,7 +7709,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: """ Overwrite an existing DNS record. @@ -7426,6 +7738,8 @@ async def update( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -7454,6 +7768,9 @@ async def update( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_update_params.ARecordSettings + | record_update_params.CNAMERecordSettings + | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["A"] @@ -7490,7 +7807,6 @@ async def update( | record_update_params.SSHFPRecordData | record_update_params.URIRecordData | NotGiven = NOT_GIVEN, - settings: record_update_params.CNAMERecordSettings | NotGiven = NOT_GIVEN, priority: float | 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. @@ -7498,13 +7814,13 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordUpdateResponse]: + ) -> Optional[RecordResponse]: if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not dns_record_id: raise ValueError(f"Expected a non-empty value for `dns_record_id` but received {dns_record_id!r}") return cast( - Optional[RecordUpdateResponse], + Optional[RecordResponse], await self._put( f"/zones/{zone_id}/dns_records/{dns_record_id}", body=await async_maybe_transform( @@ -7513,11 +7829,11 @@ async def update( "content": content, "name": name, "proxied": proxied, + "settings": settings, "tags": tags, "ttl": ttl, "type": type, "data": data, - "settings": settings, "priority": priority, }, record_update_params.RecordUpdateParams, @@ -7527,10 +7843,10 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[RecordUpdateResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[RecordResponse]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[RecordUpdateResponse] + Any, ResultWrapper[RecordResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -7581,7 +7897,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[RecordListResponse, AsyncV4PagePaginationArray[RecordListResponse]]: + ) -> AsyncPaginator[RecordResponse, AsyncV4PagePaginationArray[RecordResponse]]: """ List, search, sort, and filter a zones' DNS records. @@ -7629,7 +7945,7 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return self._get_api_list( f"/zones/{zone_id}/dns_records", - page=AsyncV4PagePaginationArray[RecordListResponse], + page=AsyncV4PagePaginationArray[RecordResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -7654,7 +7970,7 @@ def list( record_list_params.RecordListParams, ), ), - model=cast(Any, RecordListResponse), # Union types cannot be passed in as arguments in the type system + model=cast(Any, RecordResponse), # Union types cannot be passed in as arguments in the type system ) async def delete( @@ -7706,9 +8022,9 @@ async def batch( *, zone_id: str, deletes: Iterable[record_batch_params.Delete] | NotGiven = NOT_GIVEN, - patches: Iterable[record_batch_params.Patch] | NotGiven = NOT_GIVEN, + patches: Iterable[BatchPatchParam] | NotGiven = NOT_GIVEN, posts: Iterable[RecordParam] | NotGiven = NOT_GIVEN, - puts: Iterable[record_batch_params.Put] | NotGiven = NOT_GIVEN, + puts: Iterable[BatchPutParam] | 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, @@ -7779,6 +8095,7 @@ async def edit( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.ARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["A"] | NotGiven = NOT_GIVEN, @@ -7788,7 +8105,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -7814,6 +8131,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -7842,6 +8161,7 @@ async def edit( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.AAAARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["AAAA"] | NotGiven = NOT_GIVEN, @@ -7851,7 +8171,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -7877,6 +8197,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -7905,6 +8227,7 @@ async def edit( data: record_edit_params.CAARecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.CAARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["CAA"] | NotGiven = NOT_GIVEN, @@ -7914,7 +8237,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -7940,6 +8263,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -7968,6 +8293,7 @@ async def edit( data: record_edit_params.CERTRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.CERTRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["CERT"] | NotGiven = NOT_GIVEN, @@ -7977,7 +8303,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -8003,6 +8329,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -8041,7 +8369,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -8067,6 +8395,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -8095,6 +8425,7 @@ async def edit( data: record_edit_params.DNSKEYRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.DNSKEYRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["DNSKEY"] | NotGiven = NOT_GIVEN, @@ -8104,7 +8435,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -8130,6 +8461,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -8158,6 +8491,7 @@ async def edit( data: record_edit_params.DSRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.DSRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["DS"] | NotGiven = NOT_GIVEN, @@ -8167,7 +8501,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -8193,6 +8527,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -8221,6 +8557,7 @@ async def edit( data: record_edit_params.HTTPSRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.HTTPSRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["HTTPS"] | NotGiven = NOT_GIVEN, @@ -8230,7 +8567,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -8256,6 +8593,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -8284,6 +8623,7 @@ async def edit( data: record_edit_params.LOCRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.LOCRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["LOC"] | NotGiven = NOT_GIVEN, @@ -8293,7 +8633,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -8319,6 +8659,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -8348,6 +8690,7 @@ async def edit( name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.MXRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["MX"] | NotGiven = NOT_GIVEN, @@ -8357,7 +8700,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -8386,6 +8729,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -8414,6 +8759,7 @@ async def edit( data: record_edit_params.NAPTRRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.NAPTRRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["NAPTR"] | NotGiven = NOT_GIVEN, @@ -8423,7 +8769,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -8449,6 +8795,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -8477,6 +8825,7 @@ async def edit( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.NSRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["NS"] | NotGiven = NOT_GIVEN, @@ -8486,7 +8835,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -8512,6 +8861,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -8540,6 +8891,7 @@ async def edit( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.DNSRecordsOpenpgpkeyRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["OPENPGPKEY"] | NotGiven = NOT_GIVEN, @@ -8549,7 +8901,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -8575,6 +8927,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -8603,6 +8957,7 @@ async def edit( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.PTRRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["PTR"] | NotGiven = NOT_GIVEN, @@ -8612,7 +8967,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -8638,6 +8993,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -8666,6 +9023,7 @@ async def edit( data: record_edit_params.SMIMEARecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.SMIMEARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SMIMEA"] | NotGiven = NOT_GIVEN, @@ -8675,7 +9033,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -8701,6 +9059,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -8729,6 +9089,7 @@ async def edit( data: record_edit_params.SRVRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.SRVRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SRV"] | NotGiven = NOT_GIVEN, @@ -8738,7 +9099,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -8764,6 +9125,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -8792,6 +9155,7 @@ async def edit( data: record_edit_params.SSHFPRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.SSHFPRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SSHFP"] | NotGiven = NOT_GIVEN, @@ -8801,7 +9165,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -8827,6 +9191,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -8855,6 +9221,7 @@ async def edit( data: record_edit_params.SVCBRecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.SVCBRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["SVCB"] | NotGiven = NOT_GIVEN, @@ -8864,7 +9231,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -8890,6 +9257,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -8918,6 +9287,7 @@ async def edit( data: record_edit_params.TLSARecordData | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.TLSARecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["TLSA"] | NotGiven = NOT_GIVEN, @@ -8927,7 +9297,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -8953,6 +9323,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -8981,6 +9353,7 @@ async def edit( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.TXTRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["TXT"] | NotGiven = NOT_GIVEN, @@ -8990,7 +9363,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -9021,6 +9394,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -9050,6 +9425,7 @@ async def edit( name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.URIRecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["URI"] | NotGiven = NOT_GIVEN, @@ -9059,7 +9435,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: """ Update an existing DNS record. @@ -9088,6 +9464,8 @@ async def edit( proxied: Whether the record is receiving the performance and security benefits of Cloudflare. + settings: Settings for the DNS record. + tags: Custom tags for the DNS record. This field has no effect on DNS responses. ttl: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -9116,6 +9494,7 @@ async def edit( content: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, + settings: record_edit_params.ARecordSettings | record_edit_params.CNAMERecordSettings | NotGiven = NOT_GIVEN, tags: List[RecordTags] | NotGiven = NOT_GIVEN, ttl: TTLParam | NotGiven = NOT_GIVEN, type: Literal["A"] @@ -9152,7 +9531,6 @@ async def edit( | record_edit_params.SSHFPRecordData | record_edit_params.URIRecordData | NotGiven = NOT_GIVEN, - settings: record_edit_params.CNAMERecordSettings | NotGiven = NOT_GIVEN, priority: float | 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. @@ -9160,13 +9538,13 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordEditResponse]: + ) -> Optional[RecordResponse]: if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not dns_record_id: raise ValueError(f"Expected a non-empty value for `dns_record_id` but received {dns_record_id!r}") return cast( - Optional[RecordEditResponse], + Optional[RecordResponse], await self._patch( f"/zones/{zone_id}/dns_records/{dns_record_id}", body=await async_maybe_transform( @@ -9175,11 +9553,11 @@ async def edit( "content": content, "name": name, "proxied": proxied, + "settings": settings, "tags": tags, "ttl": ttl, "type": type, "data": data, - "settings": settings, "priority": priority, }, record_edit_params.RecordEditParams, @@ -9189,10 +9567,10 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[RecordEditResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[RecordResponse]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[RecordEditResponse] + Any, ResultWrapper[RecordResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -9250,7 +9628,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RecordGetResponse]: + ) -> Optional[RecordResponse]: """ DNS Record Details @@ -9272,7 +9650,7 @@ async def get( if not dns_record_id: raise ValueError(f"Expected a non-empty value for `dns_record_id` but received {dns_record_id!r}") return cast( - Optional[RecordGetResponse], + Optional[RecordResponse], await self._get( f"/zones/{zone_id}/dns_records/{dns_record_id}", options=make_request_options( @@ -9280,10 +9658,10 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[RecordGetResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[RecordResponse]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[RecordGetResponse] + Any, ResultWrapper[RecordResponse] ), # Union types cannot be passed in as arguments in the type system ), ) diff --git a/src/cloudflare/resources/email_security/settings/block_senders.py b/src/cloudflare/resources/email_security/settings/block_senders.py index 41d3e4cfd67..d540e200fce 100644 --- a/src/cloudflare/resources/email_security/settings/block_senders.py +++ b/src/cloudflare/resources/email_security/settings/block_senders.py @@ -2,14 +2,13 @@ from __future__ import annotations -from typing import Any, Type, Iterable, Optional, cast -from typing_extensions import Literal, overload +from typing import Type, Optional, cast +from typing_extensions import Literal import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( - required_args, maybe_transform, async_maybe_transform, ) @@ -58,7 +57,6 @@ def with_streaming_response(self) -> BlockSendersResourceWithStreamingResponse: """ return BlockSendersResourceWithStreamingResponse(self) - @overload def create( self, *, @@ -88,81 +86,27 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @overload - def create( - self, - *, - account_id: str, - body: Iterable[block_sender_create_params.Variant1Body], - # 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, - ) -> BlockSenderCreateResponse: - """ - Create a blocked email sender - - Args: - account_id: Account 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 - """ - ... - - @required_args(["account_id", "is_regex", "pattern", "pattern_type"], ["account_id", "body"]) - def create( - self, - *, - account_id: str, - is_regex: bool | NotGiven = NOT_GIVEN, - pattern: str | NotGiven = NOT_GIVEN, - pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"] | NotGiven = NOT_GIVEN, - comments: Optional[str] | NotGiven = NOT_GIVEN, - body: Iterable[block_sender_create_params.Variant1Body] | 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, - ) -> BlockSenderCreateResponse: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return cast( - BlockSenderCreateResponse, - self._post( - f"/accounts/{account_id}/email-security/settings/block_senders", - body=maybe_transform( - { - "is_regex": is_regex, - "pattern": pattern, - "pattern_type": pattern_type, - "comments": comments, - "body": body, - }, - block_sender_create_params.BlockSenderCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[BlockSenderCreateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[BlockSenderCreateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._post( + f"/accounts/{account_id}/email-security/settings/block_senders", + body=maybe_transform( + { + "is_regex": is_regex, + "pattern": pattern, + "pattern_type": pattern_type, + "comments": comments, + }, + block_sender_create_params.BlockSenderCreateParams, ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[BlockSenderCreateResponse]._unwrapper, + ), + cast_to=cast(Type[BlockSenderCreateResponse], ResultWrapper[BlockSenderCreateResponse]), ) def list( @@ -251,6 +195,8 @@ def delete( Args: account_id: Account Identifier + pattern_id: The unique identifier for the allow policy. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -295,6 +241,8 @@ def edit( Args: account_id: Account Identifier + pattern_id: The unique identifier for the allow policy. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -344,6 +292,8 @@ def get( Args: account_id: Account Identifier + pattern_id: The unique identifier for the allow policy. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -387,7 +337,6 @@ def with_streaming_response(self) -> AsyncBlockSendersResourceWithStreamingRespo """ return AsyncBlockSendersResourceWithStreamingResponse(self) - @overload async def create( self, *, @@ -417,81 +366,27 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @overload - async def create( - self, - *, - account_id: str, - body: Iterable[block_sender_create_params.Variant1Body], - # 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, - ) -> BlockSenderCreateResponse: - """ - Create a blocked email sender - - Args: - account_id: Account 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 - """ - ... - - @required_args(["account_id", "is_regex", "pattern", "pattern_type"], ["account_id", "body"]) - async def create( - self, - *, - account_id: str, - is_regex: bool | NotGiven = NOT_GIVEN, - pattern: str | NotGiven = NOT_GIVEN, - pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"] | NotGiven = NOT_GIVEN, - comments: Optional[str] | NotGiven = NOT_GIVEN, - body: Iterable[block_sender_create_params.Variant1Body] | 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, - ) -> BlockSenderCreateResponse: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return cast( - BlockSenderCreateResponse, - await self._post( - f"/accounts/{account_id}/email-security/settings/block_senders", - body=await async_maybe_transform( - { - "is_regex": is_regex, - "pattern": pattern, - "pattern_type": pattern_type, - "comments": comments, - "body": body, - }, - block_sender_create_params.BlockSenderCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[BlockSenderCreateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[BlockSenderCreateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._post( + f"/accounts/{account_id}/email-security/settings/block_senders", + body=await async_maybe_transform( + { + "is_regex": is_regex, + "pattern": pattern, + "pattern_type": pattern_type, + "comments": comments, + }, + block_sender_create_params.BlockSenderCreateParams, ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[BlockSenderCreateResponse]._unwrapper, + ), + cast_to=cast(Type[BlockSenderCreateResponse], ResultWrapper[BlockSenderCreateResponse]), ) def list( @@ -580,6 +475,8 @@ async def delete( Args: account_id: Account Identifier + pattern_id: The unique identifier for the allow policy. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -624,6 +521,8 @@ async def edit( Args: account_id: Account Identifier + pattern_id: The unique identifier for the allow policy. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -673,6 +572,8 @@ async def get( Args: account_id: Account Identifier + pattern_id: The unique identifier for the allow policy. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/cloudflare/resources/email_security/settings/impersonation_registry.py b/src/cloudflare/resources/email_security/settings/impersonation_registry.py index bb67428ecff..29b5532a411 100644 --- a/src/cloudflare/resources/email_security/settings/impersonation_registry.py +++ b/src/cloudflare/resources/email_security/settings/impersonation_registry.py @@ -2,14 +2,13 @@ from __future__ import annotations -from typing import Any, Type, Iterable, Optional, cast -from typing_extensions import Literal, overload +from typing import Type, Optional, cast +from typing_extensions import Literal import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( - required_args, maybe_transform, async_maybe_transform, ) @@ -58,7 +57,6 @@ def with_streaming_response(self) -> ImpersonationRegistryResourceWithStreamingR """ return ImpersonationRegistryResourceWithStreamingResponse(self) - @overload def create( self, *, @@ -87,79 +85,26 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @overload - def create( - self, - *, - account_id: str, - body: Iterable[impersonation_registry_create_params.Variant1Body], - # 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, - ) -> ImpersonationRegistryCreateResponse: - """ - Create an entry in impersonation registry - - Args: - account_id: Account 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 - """ - ... - - @required_args(["account_id", "email", "is_email_regex", "name"], ["account_id", "body"]) - def create( - self, - *, - account_id: str, - email: str | NotGiven = NOT_GIVEN, - is_email_regex: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - body: Iterable[impersonation_registry_create_params.Variant1Body] | 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, - ) -> ImpersonationRegistryCreateResponse: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return cast( - ImpersonationRegistryCreateResponse, - self._post( - f"/accounts/{account_id}/email-security/settings/impersonation_registry", - body=maybe_transform( - { - "email": email, - "is_email_regex": is_email_regex, - "name": name, - "body": body, - }, - impersonation_registry_create_params.ImpersonationRegistryCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[ImpersonationRegistryCreateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ImpersonationRegistryCreateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._post( + f"/accounts/{account_id}/email-security/settings/impersonation_registry", + body=maybe_transform( + { + "email": email, + "is_email_regex": is_email_regex, + "name": name, + }, + impersonation_registry_create_params.ImpersonationRegistryCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ImpersonationRegistryCreateResponse]._unwrapper, ), + cast_to=cast(Type[ImpersonationRegistryCreateResponse], ResultWrapper[ImpersonationRegistryCreateResponse]), ) def list( @@ -383,7 +328,6 @@ def with_streaming_response(self) -> AsyncImpersonationRegistryResourceWithStrea """ return AsyncImpersonationRegistryResourceWithStreamingResponse(self) - @overload async def create( self, *, @@ -412,79 +356,26 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @overload - async def create( - self, - *, - account_id: str, - body: Iterable[impersonation_registry_create_params.Variant1Body], - # 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, - ) -> ImpersonationRegistryCreateResponse: - """ - Create an entry in impersonation registry - - Args: - account_id: Account 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 - """ - ... - - @required_args(["account_id", "email", "is_email_regex", "name"], ["account_id", "body"]) - async def create( - self, - *, - account_id: str, - email: str | NotGiven = NOT_GIVEN, - is_email_regex: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - body: Iterable[impersonation_registry_create_params.Variant1Body] | 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, - ) -> ImpersonationRegistryCreateResponse: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return cast( - ImpersonationRegistryCreateResponse, - await self._post( - f"/accounts/{account_id}/email-security/settings/impersonation_registry", - body=await async_maybe_transform( - { - "email": email, - "is_email_regex": is_email_regex, - "name": name, - "body": body, - }, - impersonation_registry_create_params.ImpersonationRegistryCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[ImpersonationRegistryCreateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ImpersonationRegistryCreateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._post( + f"/accounts/{account_id}/email-security/settings/impersonation_registry", + body=await async_maybe_transform( + { + "email": email, + "is_email_regex": is_email_regex, + "name": name, + }, + impersonation_registry_create_params.ImpersonationRegistryCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ImpersonationRegistryCreateResponse]._unwrapper, ), + cast_to=cast(Type[ImpersonationRegistryCreateResponse], ResultWrapper[ImpersonationRegistryCreateResponse]), ) def list( diff --git a/src/cloudflare/resources/logpush/jobs.py b/src/cloudflare/resources/logpush/jobs.py index 59007334df7..76ed1b79c19 100644 --- a/src/cloudflare/resources/logpush/jobs.py +++ b/src/cloudflare/resources/logpush/jobs.py @@ -196,6 +196,7 @@ def update( max_upload_bytes: Optional[int] | NotGiven = NOT_GIVEN, max_upload_interval_seconds: Optional[int] | NotGiven = NOT_GIVEN, max_upload_records: Optional[int] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, output_options: Optional[OutputOptionsParam] | NotGiven = NOT_GIVEN, ownership_challenge: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -253,6 +254,10 @@ def update( lines than this. This parameter is not available for jobs with `edge` as its kind. + name: Optional human readable job name. Not unique. Cloudflare suggests that you set + this to a meaningful string, like the domain name, to make it easier to identify + your job. + output_options: The structured replacement for `logpull_options`. When including this field, the `logpull_option` field will be ignored. @@ -290,6 +295,7 @@ def update( "max_upload_bytes": max_upload_bytes, "max_upload_interval_seconds": max_upload_interval_seconds, "max_upload_records": max_upload_records, + "name": name, "output_options": output_options, "ownership_challenge": ownership_challenge, }, @@ -630,6 +636,7 @@ async def update( max_upload_bytes: Optional[int] | NotGiven = NOT_GIVEN, max_upload_interval_seconds: Optional[int] | NotGiven = NOT_GIVEN, max_upload_records: Optional[int] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, output_options: Optional[OutputOptionsParam] | NotGiven = NOT_GIVEN, ownership_challenge: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -687,6 +694,10 @@ async def update( lines than this. This parameter is not available for jobs with `edge` as its kind. + name: Optional human readable job name. Not unique. Cloudflare suggests that you set + this to a meaningful string, like the domain name, to make it easier to identify + your job. + output_options: The structured replacement for `logpull_options`. When including this field, the `logpull_option` field will be ignored. @@ -724,6 +735,7 @@ async def update( "max_upload_bytes": max_upload_bytes, "max_upload_interval_seconds": max_upload_interval_seconds, "max_upload_records": max_upload_records, + "name": name, "output_options": output_options, "ownership_challenge": ownership_challenge, }, diff --git a/src/cloudflare/resources/logpush/validate.py b/src/cloudflare/resources/logpush/validate.py index 66e3c1602a8..34d1803113c 100644 --- a/src/cloudflare/resources/logpush/validate.py +++ b/src/cloudflare/resources/logpush/validate.py @@ -21,9 +21,10 @@ ) from ..._wrappers import ResultWrapper from ..._base_client import make_request_options -from ...types.logpush import validate_origin_params, validate_destination_params +from ...types.logpush import validate_origin_params, validate_destination_params, validate_destination_exists_params from ...types.logpush.validate_origin_response import ValidateOriginResponse from ...types.logpush.validate_destination_response import ValidateDestinationResponse +from ...types.logpush.validate_destination_exists_response import ValidateDestinationExistsResponse __all__ = ["ValidateResource", "AsyncValidateResource"] @@ -62,7 +63,7 @@ def destination( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[ValidateDestinationResponse]: """ - Checks if there is an existing job with a destination. + Validates destination. Args: destination_conf: Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. @@ -94,7 +95,7 @@ def destination( account_or_zone = "zones" account_or_zone_id = zone_id return self._post( - f"/{account_or_zone}/{account_or_zone_id}/logpush/validate/destination/exists", + f"/{account_or_zone}/{account_or_zone_id}/logpush/validate/destination", body=maybe_transform( {"destination_conf": destination_conf}, validate_destination_params.ValidateDestinationParams ), @@ -108,6 +109,69 @@ def destination( cast_to=cast(Type[Optional[ValidateDestinationResponse]], ResultWrapper[ValidateDestinationResponse]), ) + def destination_exists( + self, + *, + destination_conf: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: 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, + ) -> Optional[ValidateDestinationExistsResponse]: + """ + Checks if there is an existing job with a destination. + + Args: + destination_conf: Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + Additional configuration parameters supported by the destination may be + included. + + account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. + + zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if account_id and zone_id: + raise ValueError("You cannot provide both account_id and zone_id") + + if account_id: + account_or_zone = "accounts" + account_or_zone_id = account_id + else: + if not zone_id: + raise ValueError("You must provide either account_id or zone_id") + + account_or_zone = "zones" + account_or_zone_id = zone_id + return self._post( + f"/{account_or_zone}/{account_or_zone_id}/logpush/validate/destination/exists", + body=maybe_transform( + {"destination_conf": destination_conf}, + validate_destination_exists_params.ValidateDestinationExistsParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ValidateDestinationExistsResponse]]._unwrapper, + ), + cast_to=cast( + Type[Optional[ValidateDestinationExistsResponse]], ResultWrapper[ValidateDestinationExistsResponse] + ), + ) + def origin( self, *, @@ -203,7 +267,7 @@ async def destination( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[ValidateDestinationResponse]: """ - Checks if there is an existing job with a destination. + Validates destination. Args: destination_conf: Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. @@ -235,7 +299,7 @@ async def destination( account_or_zone = "zones" account_or_zone_id = zone_id return await self._post( - f"/{account_or_zone}/{account_or_zone_id}/logpush/validate/destination/exists", + f"/{account_or_zone}/{account_or_zone_id}/logpush/validate/destination", body=await async_maybe_transform( {"destination_conf": destination_conf}, validate_destination_params.ValidateDestinationParams ), @@ -249,6 +313,69 @@ async def destination( cast_to=cast(Type[Optional[ValidateDestinationResponse]], ResultWrapper[ValidateDestinationResponse]), ) + async def destination_exists( + self, + *, + destination_conf: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: 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, + ) -> Optional[ValidateDestinationExistsResponse]: + """ + Checks if there is an existing job with a destination. + + Args: + destination_conf: Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + Additional configuration parameters supported by the destination may be + included. + + account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. + + zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if account_id and zone_id: + raise ValueError("You cannot provide both account_id and zone_id") + + if account_id: + account_or_zone = "accounts" + account_or_zone_id = account_id + else: + if not zone_id: + raise ValueError("You must provide either account_id or zone_id") + + account_or_zone = "zones" + account_or_zone_id = zone_id + return await self._post( + f"/{account_or_zone}/{account_or_zone_id}/logpush/validate/destination/exists", + body=await async_maybe_transform( + {"destination_conf": destination_conf}, + validate_destination_exists_params.ValidateDestinationExistsParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ValidateDestinationExistsResponse]]._unwrapper, + ), + cast_to=cast( + Type[Optional[ValidateDestinationExistsResponse]], ResultWrapper[ValidateDestinationExistsResponse] + ), + ) + async def origin( self, *, @@ -319,6 +446,9 @@ def __init__(self, validate: ValidateResource) -> None: self.destination = to_raw_response_wrapper( validate.destination, ) + self.destination_exists = to_raw_response_wrapper( + validate.destination_exists, + ) self.origin = to_raw_response_wrapper( validate.origin, ) @@ -331,6 +461,9 @@ def __init__(self, validate: AsyncValidateResource) -> None: self.destination = async_to_raw_response_wrapper( validate.destination, ) + self.destination_exists = async_to_raw_response_wrapper( + validate.destination_exists, + ) self.origin = async_to_raw_response_wrapper( validate.origin, ) @@ -343,6 +476,9 @@ def __init__(self, validate: ValidateResource) -> None: self.destination = to_streamed_response_wrapper( validate.destination, ) + self.destination_exists = to_streamed_response_wrapper( + validate.destination_exists, + ) self.origin = to_streamed_response_wrapper( validate.origin, ) @@ -355,6 +491,9 @@ def __init__(self, validate: AsyncValidateResource) -> None: self.destination = async_to_streamed_response_wrapper( validate.destination, ) + self.destination_exists = async_to_streamed_response_wrapper( + validate.destination_exists, + ) self.origin = async_to_streamed_response_wrapper( validate.origin, ) diff --git a/src/cloudflare/resources/magic_transit/sites/acls.py b/src/cloudflare/resources/magic_transit/sites/acls.py index c8edeccd631..a823a5bc933 100644 --- a/src/cloudflare/resources/magic_transit/sites/acls.py +++ b/src/cloudflare/resources/magic_transit/sites/acls.py @@ -61,6 +61,7 @@ def create( description: str | NotGiven = NOT_GIVEN, forward_locally: bool | NotGiven = NOT_GIVEN, protocols: List[AllowedProtocol] | NotGiven = NOT_GIVEN, + unidirectional: 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, @@ -85,6 +86,10 @@ def create( traffic locally on the Magic Connector. If not included in request, will default to false. + unidirectional: The desired traffic direction for this ACL policy. If set to "false", the policy + will allow bidirectional traffic. If set to "true", the policy will only allow + traffic in one direction. If not included in request, will default to false. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -107,6 +112,7 @@ def create( "description": description, "forward_locally": forward_locally, "protocols": protocols, + "unidirectional": unidirectional, }, acl_create_params.ACLCreateParams, ), @@ -132,6 +138,7 @@ def update( lan_2: ACLConfigurationParam | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, protocols: List[AllowedProtocol] | NotGiven = NOT_GIVEN, + unidirectional: 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, @@ -158,6 +165,10 @@ def update( name: The name of the ACL. + unidirectional: The desired traffic direction for this ACL policy. If set to "false", the policy + will allow bidirectional traffic. If set to "true", the policy will only allow + traffic in one direction. If not included in request, will default to false. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -182,6 +193,7 @@ def update( "lan_2": lan_2, "name": name, "protocols": protocols, + "unidirectional": unidirectional, }, acl_update_params.ACLUpdateParams, ), @@ -297,6 +309,7 @@ def edit( lan_2: ACLConfigurationParam | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, protocols: List[AllowedProtocol] | NotGiven = NOT_GIVEN, + unidirectional: 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, @@ -323,6 +336,10 @@ def edit( name: The name of the ACL. + unidirectional: The desired traffic direction for this ACL policy. If set to "false", the policy + will allow bidirectional traffic. If set to "true", the policy will only allow + traffic in one direction. If not included in request, will default to false. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -347,6 +364,7 @@ def edit( "lan_2": lan_2, "name": name, "protocols": protocols, + "unidirectional": unidirectional, }, acl_edit_params.ACLEditParams, ), @@ -441,6 +459,7 @@ async def create( description: str | NotGiven = NOT_GIVEN, forward_locally: bool | NotGiven = NOT_GIVEN, protocols: List[AllowedProtocol] | NotGiven = NOT_GIVEN, + unidirectional: 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, @@ -465,6 +484,10 @@ async def create( traffic locally on the Magic Connector. If not included in request, will default to false. + unidirectional: The desired traffic direction for this ACL policy. If set to "false", the policy + will allow bidirectional traffic. If set to "true", the policy will only allow + traffic in one direction. If not included in request, will default to false. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -487,6 +510,7 @@ async def create( "description": description, "forward_locally": forward_locally, "protocols": protocols, + "unidirectional": unidirectional, }, acl_create_params.ACLCreateParams, ), @@ -512,6 +536,7 @@ async def update( lan_2: ACLConfigurationParam | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, protocols: List[AllowedProtocol] | NotGiven = NOT_GIVEN, + unidirectional: 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, @@ -538,6 +563,10 @@ async def update( name: The name of the ACL. + unidirectional: The desired traffic direction for this ACL policy. If set to "false", the policy + will allow bidirectional traffic. If set to "true", the policy will only allow + traffic in one direction. If not included in request, will default to false. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -562,6 +591,7 @@ async def update( "lan_2": lan_2, "name": name, "protocols": protocols, + "unidirectional": unidirectional, }, acl_update_params.ACLUpdateParams, ), @@ -677,6 +707,7 @@ async def edit( lan_2: ACLConfigurationParam | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, protocols: List[AllowedProtocol] | NotGiven = NOT_GIVEN, + unidirectional: 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, @@ -703,6 +734,10 @@ async def edit( name: The name of the ACL. + unidirectional: The desired traffic direction for this ACL policy. If set to "false", the policy + will allow bidirectional traffic. If set to "true", the policy will only allow + traffic in one direction. If not included in request, will default to false. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -727,6 +762,7 @@ async def edit( "lan_2": lan_2, "name": name, "protocols": protocols, + "unidirectional": unidirectional, }, acl_edit_params.ACLEditParams, ), diff --git a/src/cloudflare/resources/managed_transforms.py b/src/cloudflare/resources/managed_transforms.py index 9ac119e110b..50bfea9758a 100644 --- a/src/cloudflare/resources/managed_transforms.py +++ b/src/cloudflare/resources/managed_transforms.py @@ -2,11 +2,11 @@ from __future__ import annotations -from typing import Iterable +from typing import Type, Iterable, cast import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven from .._utils import ( maybe_transform, async_maybe_transform, @@ -19,9 +19,9 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) +from .._wrappers import ResultWrapper from .._base_client import make_request_options from ..types.managed_transforms import managed_transform_edit_params -from ..types.managed_transforms.request_model_param import RequestModelParam from ..types.managed_transforms.managed_transform_edit_response import ManagedTransformEditResponse from ..types.managed_transforms.managed_transform_list_response import ManagedTransformListResponse @@ -63,7 +63,7 @@ def list( Fetches a list of all Managed Transforms. Args: - zone_id: Identifier + zone_id: The unique ID of the zone. extra_headers: Send extra headers @@ -76,19 +76,59 @@ def list( if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return self._get( + f"/zones/{zone_id}/managed_headers", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ManagedTransformListResponse]._unwrapper, + ), + cast_to=cast(Type[ManagedTransformListResponse], ResultWrapper[ManagedTransformListResponse]), + ) + + def delete( + self, + *, + zone_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, + ) -> None: + """ + Disables all Managed Transforms. + + Args: + zone_id: The unique ID of the zone. + + 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 zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( f"/zones/{zone_id}/managed_headers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ManagedTransformListResponse, + cast_to=NoneType, ) def edit( self, *, zone_id: str, - managed_request_headers: Iterable[RequestModelParam], - managed_response_headers: Iterable[RequestModelParam], + managed_request_headers: Iterable[managed_transform_edit_params.ManagedRequestHeader], + managed_response_headers: Iterable[managed_transform_edit_params.ManagedResponseHeader], # 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, @@ -100,7 +140,11 @@ def edit( Updates the status of one or more Managed Transforms. Args: - zone_id: Identifier + zone_id: The unique ID of the zone. + + managed_request_headers: The list of Managed Request Transforms. + + managed_response_headers: The list of Managed Response Transforms. extra_headers: Send extra headers @@ -122,9 +166,13 @@ def edit( managed_transform_edit_params.ManagedTransformEditParams, ), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ManagedTransformEditResponse]._unwrapper, ), - cast_to=ManagedTransformEditResponse, + cast_to=cast(Type[ManagedTransformEditResponse], ResultWrapper[ManagedTransformEditResponse]), ) @@ -163,7 +211,7 @@ async def list( Fetches a list of all Managed Transforms. Args: - zone_id: Identifier + zone_id: The unique ID of the zone. extra_headers: Send extra headers @@ -176,19 +224,59 @@ async def list( if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return await self._get( + f"/zones/{zone_id}/managed_headers", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ManagedTransformListResponse]._unwrapper, + ), + cast_to=cast(Type[ManagedTransformListResponse], ResultWrapper[ManagedTransformListResponse]), + ) + + async def delete( + self, + *, + zone_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, + ) -> None: + """ + Disables all Managed Transforms. + + Args: + zone_id: The unique ID of the zone. + + 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 zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( f"/zones/{zone_id}/managed_headers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ManagedTransformListResponse, + cast_to=NoneType, ) async def edit( self, *, zone_id: str, - managed_request_headers: Iterable[RequestModelParam], - managed_response_headers: Iterable[RequestModelParam], + managed_request_headers: Iterable[managed_transform_edit_params.ManagedRequestHeader], + managed_response_headers: Iterable[managed_transform_edit_params.ManagedResponseHeader], # 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, @@ -200,7 +288,11 @@ async def edit( Updates the status of one or more Managed Transforms. Args: - zone_id: Identifier + zone_id: The unique ID of the zone. + + managed_request_headers: The list of Managed Request Transforms. + + managed_response_headers: The list of Managed Response Transforms. extra_headers: Send extra headers @@ -222,9 +314,13 @@ async def edit( managed_transform_edit_params.ManagedTransformEditParams, ), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ManagedTransformEditResponse]._unwrapper, ), - cast_to=ManagedTransformEditResponse, + cast_to=cast(Type[ManagedTransformEditResponse], ResultWrapper[ManagedTransformEditResponse]), ) @@ -235,6 +331,9 @@ def __init__(self, managed_transforms: ManagedTransformsResource) -> None: self.list = to_raw_response_wrapper( managed_transforms.list, ) + self.delete = to_raw_response_wrapper( + managed_transforms.delete, + ) self.edit = to_raw_response_wrapper( managed_transforms.edit, ) @@ -247,6 +346,9 @@ def __init__(self, managed_transforms: AsyncManagedTransformsResource) -> None: self.list = async_to_raw_response_wrapper( managed_transforms.list, ) + self.delete = async_to_raw_response_wrapper( + managed_transforms.delete, + ) self.edit = async_to_raw_response_wrapper( managed_transforms.edit, ) @@ -259,6 +361,9 @@ def __init__(self, managed_transforms: ManagedTransformsResource) -> None: self.list = to_streamed_response_wrapper( managed_transforms.list, ) + self.delete = to_streamed_response_wrapper( + managed_transforms.delete, + ) self.edit = to_streamed_response_wrapper( managed_transforms.edit, ) @@ -271,6 +376,9 @@ def __init__(self, managed_transforms: AsyncManagedTransformsResource) -> None: self.list = async_to_streamed_response_wrapper( managed_transforms.list, ) + self.delete = async_to_streamed_response_wrapper( + managed_transforms.delete, + ) self.edit = async_to_streamed_response_wrapper( managed_transforms.edit, ) diff --git a/src/cloudflare/resources/origin_post_quantum_encryption.py b/src/cloudflare/resources/origin_post_quantum_encryption.py index bda025f507b..ff991b49d4c 100644 --- a/src/cloudflare/resources/origin_post_quantum_encryption.py +++ b/src/cloudflare/resources/origin_post_quantum_encryption.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -64,7 +64,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OriginPostQuantumEncryptionUpdateResponse: + ) -> Optional[OriginPostQuantumEncryptionUpdateResponse]: """ Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when connecting to your origin. Preferred instructs Cloudflare to opportunistically @@ -88,24 +88,21 @@ def update( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - OriginPostQuantumEncryptionUpdateResponse, - self._put( - f"/zones/{zone_id}/cache/origin_post_quantum_encryption", - body=maybe_transform( - {"value": value}, - origin_post_quantum_encryption_update_params.OriginPostQuantumEncryptionUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[OriginPostQuantumEncryptionUpdateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[OriginPostQuantumEncryptionUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._put( + f"/zones/{zone_id}/cache/origin_post_quantum_encryption", + body=maybe_transform( + {"value": value}, origin_post_quantum_encryption_update_params.OriginPostQuantumEncryptionUpdateParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[OriginPostQuantumEncryptionUpdateResponse]]._unwrapper, + ), + cast_to=cast( + Type[Optional[OriginPostQuantumEncryptionUpdateResponse]], + ResultWrapper[OriginPostQuantumEncryptionUpdateResponse], ), ) @@ -119,7 +116,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OriginPostQuantumEncryptionGetResponse: + ) -> Optional[OriginPostQuantumEncryptionGetResponse]: """ Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when connecting to your origin. Preferred instructs Cloudflare to opportunistically @@ -141,20 +138,18 @@ def get( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - OriginPostQuantumEncryptionGetResponse, - self._get( - f"/zones/{zone_id}/cache/origin_post_quantum_encryption", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[OriginPostQuantumEncryptionGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[OriginPostQuantumEncryptionGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/zones/{zone_id}/cache/origin_post_quantum_encryption", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[OriginPostQuantumEncryptionGetResponse]]._unwrapper, + ), + cast_to=cast( + Type[Optional[OriginPostQuantumEncryptionGetResponse]], + ResultWrapper[OriginPostQuantumEncryptionGetResponse], ), ) @@ -190,7 +185,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OriginPostQuantumEncryptionUpdateResponse: + ) -> Optional[OriginPostQuantumEncryptionUpdateResponse]: """ Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when connecting to your origin. Preferred instructs Cloudflare to opportunistically @@ -214,24 +209,21 @@ async def update( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - OriginPostQuantumEncryptionUpdateResponse, - await self._put( - f"/zones/{zone_id}/cache/origin_post_quantum_encryption", - body=await async_maybe_transform( - {"value": value}, - origin_post_quantum_encryption_update_params.OriginPostQuantumEncryptionUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[OriginPostQuantumEncryptionUpdateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[OriginPostQuantumEncryptionUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._put( + f"/zones/{zone_id}/cache/origin_post_quantum_encryption", + body=await async_maybe_transform( + {"value": value}, origin_post_quantum_encryption_update_params.OriginPostQuantumEncryptionUpdateParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[OriginPostQuantumEncryptionUpdateResponse]]._unwrapper, + ), + cast_to=cast( + Type[Optional[OriginPostQuantumEncryptionUpdateResponse]], + ResultWrapper[OriginPostQuantumEncryptionUpdateResponse], ), ) @@ -245,7 +237,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OriginPostQuantumEncryptionGetResponse: + ) -> Optional[OriginPostQuantumEncryptionGetResponse]: """ Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when connecting to your origin. Preferred instructs Cloudflare to opportunistically @@ -267,20 +259,18 @@ async def get( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - OriginPostQuantumEncryptionGetResponse, - await self._get( - f"/zones/{zone_id}/cache/origin_post_quantum_encryption", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[OriginPostQuantumEncryptionGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[OriginPostQuantumEncryptionGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/zones/{zone_id}/cache/origin_post_quantum_encryption", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[OriginPostQuantumEncryptionGetResponse]]._unwrapper, + ), + cast_to=cast( + Type[Optional[OriginPostQuantumEncryptionGetResponse]], + ResultWrapper[OriginPostQuantumEncryptionGetResponse], ), ) diff --git a/src/cloudflare/resources/r2/buckets/buckets.py b/src/cloudflare/resources/r2/buckets/buckets.py index d1556b62dd5..042d0b13c48 100644 --- a/src/cloudflare/resources/r2/buckets/buckets.py +++ b/src/cloudflare/resources/r2/buckets/buckets.py @@ -118,7 +118,7 @@ def create( name: str, location_hint: Literal["apac", "eeur", "enam", "weur", "wnam"] | NotGiven = NOT_GIVEN, storage_class: Literal["Standard", "InfrequentAccess"] | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -138,7 +138,7 @@ def create( storage_class: Storage class for newly uploaded objects, unless specified otherwise. - cf_r2_jurisdiction: Creates the bucket in the provided jurisdiction + jurisdiction: Creates the bucket in the provided jurisdiction extra_headers: Send extra headers @@ -151,9 +151,7 @@ def create( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._post( @@ -186,7 +184,7 @@ def list( order: Literal["name"] | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, start_after: str | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -214,7 +212,7 @@ def list( start_after: Bucket name to start searching after. Buckets are ordered lexicographically. - cf_r2_jurisdiction: Lists buckets in the provided jurisdiction + jurisdiction: Lists buckets in the provided jurisdiction extra_headers: Send extra headers @@ -227,9 +225,7 @@ def list( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._get( @@ -260,7 +256,7 @@ def delete( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -276,7 +272,7 @@ def delete( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -291,9 +287,7 @@ def delete( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._delete( @@ -313,7 +307,7 @@ def get( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -329,7 +323,7 @@ def get( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -344,9 +338,7 @@ def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._get( @@ -409,7 +401,7 @@ async def create( name: str, location_hint: Literal["apac", "eeur", "enam", "weur", "wnam"] | NotGiven = NOT_GIVEN, storage_class: Literal["Standard", "InfrequentAccess"] | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -429,7 +421,7 @@ async def create( storage_class: Storage class for newly uploaded objects, unless specified otherwise. - cf_r2_jurisdiction: Creates the bucket in the provided jurisdiction + jurisdiction: Creates the bucket in the provided jurisdiction extra_headers: Send extra headers @@ -442,9 +434,7 @@ async def create( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._post( @@ -477,7 +467,7 @@ async def list( order: Literal["name"] | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, start_after: str | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -505,7 +495,7 @@ async def list( start_after: Bucket name to start searching after. Buckets are ordered lexicographically. - cf_r2_jurisdiction: Lists buckets in the provided jurisdiction + jurisdiction: Lists buckets in the provided jurisdiction extra_headers: Send extra headers @@ -518,9 +508,7 @@ async def list( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._get( @@ -551,7 +539,7 @@ async def delete( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -567,7 +555,7 @@ async def delete( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -582,9 +570,7 @@ async def delete( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._delete( @@ -604,7 +590,7 @@ async def get( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -620,7 +606,7 @@ async def get( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -635,9 +621,7 @@ async def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._get( diff --git a/src/cloudflare/resources/r2/buckets/cors.py b/src/cloudflare/resources/r2/buckets/cors.py index b028f6feec6..e56363fc759 100644 --- a/src/cloudflare/resources/r2/buckets/cors.py +++ b/src/cloudflare/resources/r2/buckets/cors.py @@ -56,7 +56,7 @@ def update( *, account_id: str, rules: Iterable[cors_update_params.Rule] | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -72,7 +72,7 @@ def update( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -87,9 +87,7 @@ def update( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._put( @@ -110,7 +108,7 @@ def delete( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -126,7 +124,7 @@ def delete( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -141,9 +139,7 @@ def delete( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._delete( @@ -163,7 +159,7 @@ def get( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -179,7 +175,7 @@ def get( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -194,9 +190,7 @@ def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._get( @@ -238,7 +232,7 @@ async def update( *, account_id: str, rules: Iterable[cors_update_params.Rule] | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -254,7 +248,7 @@ async def update( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -269,9 +263,7 @@ async def update( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._put( @@ -292,7 +284,7 @@ async def delete( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -308,7 +300,7 @@ async def delete( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -323,9 +315,7 @@ async def delete( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._delete( @@ -345,7 +335,7 @@ async def get( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -361,7 +351,7 @@ async def get( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -376,9 +366,7 @@ async def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._get( diff --git a/src/cloudflare/resources/r2/buckets/domains/custom.py b/src/cloudflare/resources/r2/buckets/domains/custom.py index 34f2cac3387..9a0f624592e 100644 --- a/src/cloudflare/resources/r2/buckets/domains/custom.py +++ b/src/cloudflare/resources/r2/buckets/domains/custom.py @@ -63,7 +63,7 @@ def create( enabled: bool, zone_id: str, min_tls: Literal["1.0", "1.1", "1.2", "1.3"] | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -89,7 +89,7 @@ def create( min_tls: Minimum TLS Version the custom domain will accept for incoming connections. If not set, defaults to 1.0. - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -104,9 +104,7 @@ def create( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._post( @@ -138,7 +136,7 @@ def update( bucket_name: str, enabled: bool | NotGiven = NOT_GIVEN, min_tls: Literal["1.0", "1.1", "1.2", "1.3"] | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -161,7 +159,7 @@ def update( min_tls: Minimum TLS Version the custom domain will accept for incoming connections. If not set, defaults to previous value. - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -178,9 +176,7 @@ def update( if not domain_name: raise ValueError(f"Expected a non-empty value for `domain_name` but received {domain_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._put( @@ -207,7 +203,7 @@ def list( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -223,7 +219,7 @@ def list( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -238,9 +234,7 @@ def list( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._get( @@ -261,7 +255,7 @@ def delete( *, account_id: str, bucket_name: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -279,7 +273,7 @@ def delete( domain_name: Name of the custom domain - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -296,9 +290,7 @@ def delete( if not domain_name: raise ValueError(f"Expected a non-empty value for `domain_name` but received {domain_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._delete( @@ -319,7 +311,7 @@ def get( *, account_id: str, bucket_name: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -337,7 +329,7 @@ def get( domain_name: Name of the custom domain - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -354,9 +346,7 @@ def get( if not domain_name: raise ValueError(f"Expected a non-empty value for `domain_name` but received {domain_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._get( @@ -401,7 +391,7 @@ async def create( enabled: bool, zone_id: str, min_tls: Literal["1.0", "1.1", "1.2", "1.3"] | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -427,7 +417,7 @@ async def create( min_tls: Minimum TLS Version the custom domain will accept for incoming connections. If not set, defaults to 1.0. - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -442,9 +432,7 @@ async def create( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._post( @@ -476,7 +464,7 @@ async def update( bucket_name: str, enabled: bool | NotGiven = NOT_GIVEN, min_tls: Literal["1.0", "1.1", "1.2", "1.3"] | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -499,7 +487,7 @@ async def update( min_tls: Minimum TLS Version the custom domain will accept for incoming connections. If not set, defaults to previous value. - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -516,9 +504,7 @@ async def update( if not domain_name: raise ValueError(f"Expected a non-empty value for `domain_name` but received {domain_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._put( @@ -545,7 +531,7 @@ async def list( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -561,7 +547,7 @@ async def list( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -576,9 +562,7 @@ async def list( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._get( @@ -599,7 +583,7 @@ async def delete( *, account_id: str, bucket_name: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -617,7 +601,7 @@ async def delete( domain_name: Name of the custom domain - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -634,9 +618,7 @@ async def delete( if not domain_name: raise ValueError(f"Expected a non-empty value for `domain_name` but received {domain_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._delete( @@ -657,7 +639,7 @@ async def get( *, account_id: str, bucket_name: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -675,7 +657,7 @@ async def get( domain_name: Name of the custom domain - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -692,9 +674,7 @@ async def get( if not domain_name: raise ValueError(f"Expected a non-empty value for `domain_name` but received {domain_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._get( diff --git a/src/cloudflare/resources/r2/buckets/domains/managed.py b/src/cloudflare/resources/r2/buckets/domains/managed.py index 2c0b2ee4fb3..132d316021b 100644 --- a/src/cloudflare/resources/r2/buckets/domains/managed.py +++ b/src/cloudflare/resources/r2/buckets/domains/managed.py @@ -57,7 +57,7 @@ def update( *, account_id: str, enabled: bool, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -75,7 +75,7 @@ def update( enabled: Whether to enable public bucket access at the r2.dev domain - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -90,9 +90,7 @@ def update( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._put( @@ -113,7 +111,7 @@ def list( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -129,7 +127,7 @@ def list( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -144,9 +142,7 @@ def list( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._get( @@ -188,7 +184,7 @@ async def update( *, account_id: str, enabled: bool, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -206,7 +202,7 @@ async def update( enabled: Whether to enable public bucket access at the r2.dev domain - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -221,9 +217,7 @@ async def update( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._put( @@ -244,7 +238,7 @@ async def list( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -260,7 +254,7 @@ async def list( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -275,9 +269,7 @@ async def list( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._get( diff --git a/src/cloudflare/resources/r2/buckets/event_notifications/configuration/configuration.py b/src/cloudflare/resources/r2/buckets/event_notifications/configuration/configuration.py index 8dbe0b4cb45..400051aa1a9 100644 --- a/src/cloudflare/resources/r2/buckets/event_notifications/configuration/configuration.py +++ b/src/cloudflare/resources/r2/buckets/event_notifications/configuration/configuration.py @@ -61,7 +61,7 @@ def get( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -77,7 +77,7 @@ def get( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -92,9 +92,7 @@ def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._get( @@ -139,7 +137,7 @@ async def get( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -155,7 +153,7 @@ async def get( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -170,9 +168,7 @@ async def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._get( diff --git a/src/cloudflare/resources/r2/buckets/event_notifications/configuration/queues.py b/src/cloudflare/resources/r2/buckets/event_notifications/configuration/queues.py index 49728508268..3b58ade89b8 100644 --- a/src/cloudflare/resources/r2/buckets/event_notifications/configuration/queues.py +++ b/src/cloudflare/resources/r2/buckets/event_notifications/configuration/queues.py @@ -56,7 +56,7 @@ def update( account_id: str, bucket_name: str, rules: Iterable[queue_update_params.Rule] | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -76,7 +76,7 @@ def update( rules: Array of rules to drive notifications - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -93,9 +93,7 @@ def update( if not queue_id: raise ValueError(f"Expected a non-empty value for `queue_id` but received {queue_id!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._put( @@ -117,7 +115,7 @@ def delete( *, account_id: str, bucket_name: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -137,7 +135,7 @@ def delete( queue_id: Queue ID - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -154,9 +152,7 @@ def delete( if not queue_id: raise ValueError(f"Expected a non-empty value for `queue_id` but received {queue_id!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._delete( @@ -199,7 +195,7 @@ async def update( account_id: str, bucket_name: str, rules: Iterable[queue_update_params.Rule] | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -219,7 +215,7 @@ async def update( rules: Array of rules to drive notifications - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -236,9 +232,7 @@ async def update( if not queue_id: raise ValueError(f"Expected a non-empty value for `queue_id` but received {queue_id!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._put( @@ -260,7 +254,7 @@ async def delete( *, account_id: str, bucket_name: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -280,7 +274,7 @@ async def delete( queue_id: Queue ID - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -297,9 +291,7 @@ async def delete( if not queue_id: raise ValueError(f"Expected a non-empty value for `queue_id` but received {queue_id!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._delete( diff --git a/src/cloudflare/resources/r2/buckets/lifecycle.py b/src/cloudflare/resources/r2/buckets/lifecycle.py index 67fe0d0acad..96385460faf 100644 --- a/src/cloudflare/resources/r2/buckets/lifecycle.py +++ b/src/cloudflare/resources/r2/buckets/lifecycle.py @@ -56,7 +56,7 @@ def update( *, account_id: str, rules: Iterable[lifecycle_update_params.Rule] | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -72,7 +72,7 @@ def update( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -87,9 +87,7 @@ def update( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._put( @@ -110,7 +108,7 @@ def get( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -126,7 +124,7 @@ def get( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -141,9 +139,7 @@ def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._get( @@ -185,7 +181,7 @@ async def update( *, account_id: str, rules: Iterable[lifecycle_update_params.Rule] | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -201,7 +197,7 @@ async def update( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -216,9 +212,7 @@ async def update( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._put( @@ -239,7 +233,7 @@ async def get( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -255,7 +249,7 @@ async def get( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -270,9 +264,7 @@ async def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._get( diff --git a/src/cloudflare/resources/r2/buckets/sippy.py b/src/cloudflare/resources/r2/buckets/sippy.py index a8a434f7fdd..ef325b0ef87 100644 --- a/src/cloudflare/resources/r2/buckets/sippy.py +++ b/src/cloudflare/resources/r2/buckets/sippy.py @@ -60,7 +60,7 @@ def update( account_id: str, destination: sippy_update_params.R2EnableSippyAwsDestination | NotGiven = NOT_GIVEN, source: sippy_update_params.R2EnableSippyAwsSource | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -80,7 +80,7 @@ def update( source: AWS S3 bucket to copy objects from - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -100,7 +100,7 @@ def update( account_id: str, destination: sippy_update_params.R2EnableSippyGcsDestination | NotGiven = NOT_GIVEN, source: sippy_update_params.R2EnableSippyGcsSource | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -120,7 +120,7 @@ def update( source: GCS bucket to copy objects from - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -142,7 +142,7 @@ def update( source: sippy_update_params.R2EnableSippyAwsSource | sippy_update_params.R2EnableSippyGcsSource | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -155,9 +155,7 @@ def update( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._put( @@ -184,7 +182,7 @@ def delete( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -200,7 +198,7 @@ def delete( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -215,9 +213,7 @@ def delete( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._delete( @@ -237,7 +233,7 @@ def get( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -253,7 +249,7 @@ def get( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -268,9 +264,7 @@ def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return self._get( @@ -314,7 +308,7 @@ async def update( account_id: str, destination: sippy_update_params.R2EnableSippyAwsDestination | NotGiven = NOT_GIVEN, source: sippy_update_params.R2EnableSippyAwsSource | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -334,7 +328,7 @@ async def update( source: AWS S3 bucket to copy objects from - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -354,7 +348,7 @@ async def update( account_id: str, destination: sippy_update_params.R2EnableSippyGcsDestination | NotGiven = NOT_GIVEN, source: sippy_update_params.R2EnableSippyGcsSource | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -374,7 +368,7 @@ async def update( source: GCS bucket to copy objects from - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -396,7 +390,7 @@ async def update( source: sippy_update_params.R2EnableSippyAwsSource | sippy_update_params.R2EnableSippyGcsSource | NotGiven = NOT_GIVEN, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -409,9 +403,7 @@ async def update( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._put( @@ -438,7 +430,7 @@ async def delete( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -454,7 +446,7 @@ async def delete( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -469,9 +461,7 @@ async def delete( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._delete( @@ -491,7 +481,7 @@ async def get( bucket_name: str, *, account_id: str, - cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN, + jurisdiction: Literal["default", "eu", "fedramp"] | 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, @@ -507,7 +497,7 @@ async def get( bucket_name: Name of the bucket - cf_r2_jurisdiction: The bucket jurisdiction + jurisdiction: The bucket jurisdiction extra_headers: Send extra headers @@ -522,9 +512,7 @@ async def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = { - **strip_not_given( - {"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN} - ), + **strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}), **(extra_headers or {}), } return await self._get( diff --git a/src/cloudflare/resources/radar/ai/bots/summary.py b/src/cloudflare/resources/radar/ai/bots/summary.py index f1cf1315778..e8a1c0a005a 100644 --- a/src/cloudflare/resources/radar/ai/bots/summary.py +++ b/src/cloudflare/resources/radar/ai/bots/summary.py @@ -58,6 +58,7 @@ def user_agent( date_range: List[str] | NotGiven = NOT_GIVEN, date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, name: 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. @@ -90,6 +91,9 @@ def user_agent( format: Format results are returned in. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -119,6 +123,7 @@ def user_agent( "date_range": date_range, "date_start": date_start, "format": format, + "limit_per_group": limit_per_group, "location": location, "name": name, }, @@ -159,6 +164,7 @@ async def user_agent( date_range: List[str] | NotGiven = NOT_GIVEN, date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, name: 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. @@ -191,6 +197,9 @@ async def user_agent( format: Format results are returned in. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -220,6 +229,7 @@ async def user_agent( "date_range": date_range, "date_start": date_start, "format": format, + "limit_per_group": limit_per_group, "location": location, "name": name, }, diff --git a/src/cloudflare/resources/radar/as112/summary.py b/src/cloudflare/resources/radar/as112/summary.py index 34d4b1676a6..64f1fa64f29 100644 --- a/src/cloudflare/resources/radar/as112/summary.py +++ b/src/cloudflare/resources/radar/as112/summary.py @@ -386,6 +386,7 @@ def query_type( date_range: List[str] | NotGiven = NOT_GIVEN, date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, name: 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. @@ -417,6 +418,9 @@ def query_type( format: Format results are returned in. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -446,6 +450,7 @@ def query_type( "date_range": date_range, "date_start": date_start, "format": format, + "limit_per_group": limit_per_group, "location": location, "name": name, }, @@ -465,6 +470,7 @@ def response_codes( date_range: List[str] | NotGiven = NOT_GIVEN, date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, name: 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. @@ -496,6 +502,9 @@ def response_codes( format: Format results are returned in. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -525,6 +534,7 @@ def response_codes( "date_range": date_range, "date_start": date_start, "format": format, + "limit_per_group": limit_per_group, "location": location, "name": name, }, @@ -881,6 +891,7 @@ async def query_type( date_range: List[str] | NotGiven = NOT_GIVEN, date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, name: 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. @@ -912,6 +923,9 @@ async def query_type( format: Format results are returned in. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -941,6 +955,7 @@ async def query_type( "date_range": date_range, "date_start": date_start, "format": format, + "limit_per_group": limit_per_group, "location": location, "name": name, }, @@ -960,6 +975,7 @@ async def response_codes( date_range: List[str] | NotGiven = NOT_GIVEN, date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, name: 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. @@ -991,6 +1007,9 @@ async def response_codes( format: Format results are returned in. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -1020,6 +1039,7 @@ async def response_codes( "date_range": date_range, "date_start": date_start, "format": format, + "limit_per_group": limit_per_group, "location": location, "name": name, }, diff --git a/src/cloudflare/resources/radar/as112/timeseries_groups.py b/src/cloudflare/resources/radar/as112/timeseries_groups.py index 00695c14157..4571879b766 100644 --- a/src/cloudflare/resources/radar/as112/timeseries_groups.py +++ b/src/cloudflare/resources/radar/as112/timeseries_groups.py @@ -411,6 +411,7 @@ def query_type( date_range: List[str] | NotGiven = NOT_GIVEN, date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, name: 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. @@ -446,6 +447,9 @@ def query_type( format: Format results are returned in. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -476,6 +480,7 @@ def query_type( "date_range": date_range, "date_start": date_start, "format": format, + "limit_per_group": limit_per_group, "location": location, "name": name, }, @@ -496,6 +501,7 @@ def response_codes( date_range: List[str] | NotGiven = NOT_GIVEN, date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, name: 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. @@ -532,6 +538,9 @@ def response_codes( format: Format results are returned in. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -562,6 +571,7 @@ def response_codes( "date_range": date_range, "date_start": date_start, "format": format, + "limit_per_group": limit_per_group, "location": location, "name": name, }, @@ -945,6 +955,7 @@ async def query_type( date_range: List[str] | NotGiven = NOT_GIVEN, date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, name: 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. @@ -980,6 +991,9 @@ async def query_type( format: Format results are returned in. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -1010,6 +1024,7 @@ async def query_type( "date_range": date_range, "date_start": date_start, "format": format, + "limit_per_group": limit_per_group, "location": location, "name": name, }, @@ -1030,6 +1045,7 @@ async def response_codes( date_range: List[str] | NotGiven = NOT_GIVEN, date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, name: 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. @@ -1066,6 +1082,9 @@ async def response_codes( format: Format results are returned in. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -1096,6 +1115,7 @@ async def response_codes( "date_range": date_range, "date_start": date_start, "format": format, + "limit_per_group": limit_per_group, "location": location, "name": name, }, diff --git a/src/cloudflare/resources/radar/attacks/layer3/summary.py b/src/cloudflare/resources/radar/attacks/layer3/summary.py index 0e6843b6167..b4f5c7853cc 100644 --- a/src/cloudflare/resources/radar/attacks/layer3/summary.py +++ b/src/cloudflare/resources/radar/attacks/layer3/summary.py @@ -487,6 +487,7 @@ def vector( direction: Literal["ORIGIN", "TARGET"] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, name: List[str] | NotGiven = NOT_GIVEN, protocol: List[Literal["UDP", "TCP", "ICMP", "GRE"]] | NotGiven = NOT_GIVEN, @@ -520,6 +521,9 @@ def vector( ip_version: Filter for ip version. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -552,6 +556,7 @@ def vector( "direction": direction, "format": format, "ip_version": ip_version, + "limit_per_group": limit_per_group, "location": location, "name": name, "protocol": protocol, @@ -1010,6 +1015,7 @@ async def vector( direction: Literal["ORIGIN", "TARGET"] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, name: List[str] | NotGiven = NOT_GIVEN, protocol: List[Literal["UDP", "TCP", "ICMP", "GRE"]] | NotGiven = NOT_GIVEN, @@ -1043,6 +1049,9 @@ async def vector( ip_version: Filter for ip version. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -1075,6 +1084,7 @@ async def vector( "direction": direction, "format": format, "ip_version": ip_version, + "limit_per_group": limit_per_group, "location": location, "name": name, "protocol": protocol, diff --git a/src/cloudflare/resources/radar/attacks/layer7/summary.py b/src/cloudflare/resources/radar/attacks/layer7/summary.py index 2dd6c303e25..69a23e0ced4 100644 --- a/src/cloudflare/resources/radar/attacks/layer7/summary.py +++ b/src/cloudflare/resources/radar/attacks/layer7/summary.py @@ -151,6 +151,7 @@ def http_method( format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN, ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, mitigation_product: List[ Literal[ @@ -192,6 +193,9 @@ def http_method( ip_version: Filter for ip version. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -225,6 +229,7 @@ def http_method( "format": format, "http_version": http_version, "ip_version": ip_version, + "limit_per_group": limit_per_group, "location": location, "mitigation_product": mitigation_product, "name": name, @@ -590,6 +595,7 @@ def managed_rules( | NotGiven = NOT_GIVEN, http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN, ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, mitigation_product: List[ Literal[ @@ -633,6 +639,9 @@ def managed_rules( ip_version: Filter for ip version. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -667,6 +676,7 @@ def managed_rules( "http_method": http_method, "http_version": http_version, "ip_version": ip_version, + "limit_per_group": limit_per_group, "location": location, "mitigation_product": mitigation_product, "name": name, @@ -740,6 +750,7 @@ def mitigation_product( | NotGiven = NOT_GIVEN, http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN, ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, name: 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. @@ -777,6 +788,9 @@ def mitigation_product( ip_version: Filter for ip version. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -809,6 +823,7 @@ def mitigation_product( "http_method": http_method, "http_version": http_version, "ip_version": ip_version, + "limit_per_group": limit_per_group, "location": location, "name": name, }, @@ -930,6 +945,7 @@ async def http_method( format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN, ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, mitigation_product: List[ Literal[ @@ -971,6 +987,9 @@ async def http_method( ip_version: Filter for ip version. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -1004,6 +1023,7 @@ async def http_method( "format": format, "http_version": http_version, "ip_version": ip_version, + "limit_per_group": limit_per_group, "location": location, "mitigation_product": mitigation_product, "name": name, @@ -1369,6 +1389,7 @@ async def managed_rules( | NotGiven = NOT_GIVEN, http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN, ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, mitigation_product: List[ Literal[ @@ -1412,6 +1433,9 @@ async def managed_rules( ip_version: Filter for ip version. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -1446,6 +1470,7 @@ async def managed_rules( "http_method": http_method, "http_version": http_version, "ip_version": ip_version, + "limit_per_group": limit_per_group, "location": location, "mitigation_product": mitigation_product, "name": name, @@ -1519,6 +1544,7 @@ async def mitigation_product( | NotGiven = NOT_GIVEN, http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN, ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, name: 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. @@ -1556,6 +1582,9 @@ async def mitigation_product( ip_version: Filter for ip version. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -1588,6 +1617,7 @@ async def mitigation_product( "http_method": http_method, "http_version": http_version, "ip_version": ip_version, + "limit_per_group": limit_per_group, "location": location, "name": name, }, diff --git a/src/cloudflare/resources/radar/attacks/layer7/timeseries_groups.py b/src/cloudflare/resources/radar/attacks/layer7/timeseries_groups.py index 864e7659cde..e57361ae51c 100644 --- a/src/cloudflare/resources/radar/attacks/layer7/timeseries_groups.py +++ b/src/cloudflare/resources/radar/attacks/layer7/timeseries_groups.py @@ -164,6 +164,7 @@ def http_method( format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN, ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, mitigation_product: List[ Literal[ @@ -210,6 +211,9 @@ def http_method( ip_version: Filter for ip version. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -247,6 +251,7 @@ def http_method( "format": format, "http_version": http_version, "ip_version": ip_version, + "limit_per_group": limit_per_group, "location": location, "mitigation_product": mitigation_product, "name": name, @@ -802,6 +807,7 @@ def managed_rules( | NotGiven = NOT_GIVEN, http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN, ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, mitigation_product: List[ Literal[ @@ -850,6 +856,9 @@ def managed_rules( ip_version: Filter for ip version. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -888,6 +897,7 @@ def managed_rules( "http_method": http_method, "http_version": http_version, "ip_version": ip_version, + "limit_per_group": limit_per_group, "location": location, "mitigation_product": mitigation_product, "name": name, @@ -963,6 +973,7 @@ def mitigation_product( | NotGiven = NOT_GIVEN, http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN, ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, name: List[str] | NotGiven = NOT_GIVEN, normalization: Literal["PERCENTAGE", "MIN0_MAX"] | NotGiven = NOT_GIVEN, @@ -1005,6 +1016,9 @@ def mitigation_product( ip_version: Filter for ip version. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -1041,6 +1055,7 @@ def mitigation_product( "http_method": http_method, "http_version": http_version, "ip_version": ip_version, + "limit_per_group": limit_per_group, "location": location, "name": name, "normalization": normalization, @@ -1338,6 +1353,7 @@ async def http_method( format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN, ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, mitigation_product: List[ Literal[ @@ -1384,6 +1400,9 @@ async def http_method( ip_version: Filter for ip version. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -1421,6 +1440,7 @@ async def http_method( "format": format, "http_version": http_version, "ip_version": ip_version, + "limit_per_group": limit_per_group, "location": location, "mitigation_product": mitigation_product, "name": name, @@ -1976,6 +1996,7 @@ async def managed_rules( | NotGiven = NOT_GIVEN, http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN, ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, mitigation_product: List[ Literal[ @@ -2024,6 +2045,9 @@ async def managed_rules( ip_version: Filter for ip version. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -2062,6 +2086,7 @@ async def managed_rules( "http_method": http_method, "http_version": http_version, "ip_version": ip_version, + "limit_per_group": limit_per_group, "location": location, "mitigation_product": mitigation_product, "name": name, @@ -2137,6 +2162,7 @@ async def mitigation_product( | NotGiven = NOT_GIVEN, http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN, ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, name: List[str] | NotGiven = NOT_GIVEN, normalization: Literal["PERCENTAGE", "MIN0_MAX"] | NotGiven = NOT_GIVEN, @@ -2179,6 +2205,9 @@ async def mitigation_product( ip_version: Filter for ip version. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -2215,6 +2244,7 @@ async def mitigation_product( "http_method": http_method, "http_version": http_version, "ip_version": ip_version, + "limit_per_group": limit_per_group, "location": location, "name": name, "normalization": normalization, diff --git a/src/cloudflare/resources/radar/http/timeseries_groups.py b/src/cloudflare/resources/radar/http/timeseries_groups.py index d4c1800e0c5..1b1a6da94db 100644 --- a/src/cloudflare/resources/radar/http/timeseries_groups.py +++ b/src/cloudflare/resources/radar/http/timeseries_groups.py @@ -318,6 +318,7 @@ def browser_family( http_protocol: List[Literal["HTTP", "HTTPS"]] | NotGiven = NOT_GIVEN, http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN, ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, name: List[str] | NotGiven = NOT_GIVEN, os: List[Literal["WINDOWS", "MACOSX", "IOS", "ANDROID", "CHROMEOS", "LINUX", "SMART_TV"]] @@ -368,6 +369,9 @@ def browser_family( ip_version: Filter for ip version. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -407,6 +411,7 @@ def browser_family( "http_protocol": http_protocol, "http_version": http_version, "ip_version": ip_version, + "limit_per_group": limit_per_group, "location": location, "name": name, "os": os, @@ -1474,6 +1479,7 @@ async def browser_family( http_protocol: List[Literal["HTTP", "HTTPS"]] | NotGiven = NOT_GIVEN, http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN, ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit_per_group: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, name: List[str] | NotGiven = NOT_GIVEN, os: List[Literal["WINDOWS", "MACOSX", "IOS", "ANDROID", "CHROMEOS", "LINUX", "SMART_TV"]] @@ -1524,6 +1530,9 @@ async def browser_family( ip_version: Filter for ip version. + limit_per_group: Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + location: Array of comma separated list of locations (alpha-2 country codes). Start with `-` to exclude from results. For example, `-US,PT` excludes results from the US, but includes results from PT. @@ -1563,6 +1572,7 @@ async def browser_family( "http_protocol": http_protocol, "http_version": http_version, "ip_version": ip_version, + "limit_per_group": limit_per_group, "location": location, "name": name, "os": os, diff --git a/src/cloudflare/resources/radar/ranking/domain.py b/src/cloudflare/resources/radar/ranking/domain.py index 60ea7cf7f98..1c2e3a87f4f 100644 --- a/src/cloudflare/resources/radar/ranking/domain.py +++ b/src/cloudflare/resources/radar/ranking/domain.py @@ -2,7 +2,8 @@ from __future__ import annotations -from typing import List, Type, cast +from typing import List, Type, Union, cast +from datetime import date from typing_extensions import Literal import httpx @@ -52,8 +53,9 @@ def get( self, domain: str, *, - date: List[str] | NotGiven = NOT_GIVEN, + date: List[Union[str, date]] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + include_top_locations: bool | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, name: List[str] | NotGiven = NOT_GIVEN, ranking_type: Literal["POPULAR", "TRENDING_RISE", "TRENDING_STEADY"] | NotGiven = NOT_GIVEN, @@ -76,6 +78,8 @@ def get( format: Format results are returned in. + include_top_locations: Include top locations in the response. + limit: Limit the number of objects in the response. name: Array of names that will be used to name the series in responses. @@ -103,6 +107,7 @@ def get( { "date": date, "format": format, + "include_top_locations": include_top_locations, "limit": limit, "name": name, "ranking_type": ranking_type, @@ -139,8 +144,9 @@ async def get( self, domain: str, *, - date: List[str] | NotGiven = NOT_GIVEN, + date: List[Union[str, date]] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + include_top_locations: bool | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, name: List[str] | NotGiven = NOT_GIVEN, ranking_type: Literal["POPULAR", "TRENDING_RISE", "TRENDING_STEADY"] | NotGiven = NOT_GIVEN, @@ -163,6 +169,8 @@ async def get( format: Format results are returned in. + include_top_locations: Include top locations in the response. + limit: Limit the number of objects in the response. name: Array of names that will be used to name the series in responses. @@ -190,6 +198,7 @@ async def get( { "date": date, "format": format, + "include_top_locations": include_top_locations, "limit": limit, "name": name, "ranking_type": ranking_type, diff --git a/src/cloudflare/resources/radar/ranking/ranking.py b/src/cloudflare/resources/radar/ranking/ranking.py index d3b371159c1..86136d7ad46 100644 --- a/src/cloudflare/resources/radar/ranking/ranking.py +++ b/src/cloudflare/resources/radar/ranking/ranking.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import List, Type, Union, cast -from datetime import datetime +from datetime import date, datetime from typing_extensions import Literal import httpx @@ -143,7 +143,7 @@ def timeseries_groups( def top( self, *, - date: List[str] | NotGiven = NOT_GIVEN, + date: List[Union[str, date]] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, @@ -313,7 +313,7 @@ async def timeseries_groups( async def top( self, *, - date: List[str] | NotGiven = NOT_GIVEN, + date: List[Union[str, date]] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, location: List[str] | NotGiven = NOT_GIVEN, diff --git a/src/cloudflare/resources/rules/lists/items.py b/src/cloudflare/resources/rules/lists/items.py index dbe7c34c9b9..6245c7c21ce 100644 --- a/src/cloudflare/resources/rules/lists/items.py +++ b/src/cloudflare/resources/rules/lists/items.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Iterable, cast +from typing import Type, Iterable, cast import httpx @@ -219,7 +219,7 @@ def list( item_list_params.ItemListParams, ), ), - model=cast(Any, ItemListResponse), # Union types cannot be passed in as arguments in the type system + model=ItemListResponse, ) def delete( @@ -308,21 +308,16 @@ def get( raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}") if not item_id: raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}") - return cast( - ItemGetResponse, - self._get( - f"/accounts/{account_identifier}/rules/lists/{list_id}/items/{item_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[ItemGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ItemGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/accounts/{account_identifier}/rules/lists/{list_id}/items/{item_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ItemGetResponse]._unwrapper, ), + cast_to=cast(Type[ItemGetResponse], ResultWrapper[ItemGetResponse]), ) @@ -513,7 +508,7 @@ def list( item_list_params.ItemListParams, ), ), - model=cast(Any, ItemListResponse), # Union types cannot be passed in as arguments in the type system + model=ItemListResponse, ) async def delete( @@ -602,21 +597,16 @@ async def get( raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}") if not item_id: raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}") - return cast( - ItemGetResponse, - await self._get( - f"/accounts/{account_identifier}/rules/lists/{list_id}/items/{item_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[ItemGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ItemGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/accounts/{account_identifier}/rules/lists/{list_id}/items/{item_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ItemGetResponse]._unwrapper, ), + cast_to=cast(Type[ItemGetResponse], ResultWrapper[ItemGetResponse]), ) diff --git a/src/cloudflare/resources/url_normalization.py b/src/cloudflare/resources/url_normalization.py index 3fff83e46ad..87bab9c625e 100644 --- a/src/cloudflare/resources/url_normalization.py +++ b/src/cloudflare/resources/url_normalization.py @@ -2,9 +2,12 @@ from __future__ import annotations +from typing import Type, cast +from typing_extensions import Literal + import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven from .._utils import ( maybe_transform, async_maybe_transform, @@ -17,6 +20,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) +from .._wrappers import ResultWrapper from .._base_client import make_request_options from ..types.url_normalization import url_normalization_update_params from ..types.url_normalization.url_normalization_get_response import URLNormalizationGetResponse @@ -49,8 +53,8 @@ def update( self, *, zone_id: str, - scope: str | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + scope: Literal["incoming", "both"], + type: Literal["cloudflare", "rfc3986"], # 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, @@ -59,10 +63,10 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> URLNormalizationUpdateResponse: """ - Updates the URL normalization settings. + Updates the URL Normalization settings. Args: - zone_id: Identifier + zone_id: The unique ID of the zone. scope: The scope of the URL normalization. @@ -87,10 +91,50 @@ def update( }, url_normalization_update_params.URLNormalizationUpdateParams, ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[URLNormalizationUpdateResponse]._unwrapper, + ), + cast_to=cast(Type[URLNormalizationUpdateResponse], ResultWrapper[URLNormalizationUpdateResponse]), + ) + + def delete( + self, + *, + zone_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, + ) -> None: + """ + Deletes the URL Normalization settings. + + Args: + zone_id: The unique ID of the zone. + + 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 zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/zones/{zone_id}/url_normalization", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=URLNormalizationUpdateResponse, + cast_to=NoneType, ) def get( @@ -105,10 +149,10 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> URLNormalizationGetResponse: """ - Fetches the current URL normalization settings. + Fetches the current URL Normalization settings. Args: - zone_id: Identifier + zone_id: The unique ID of the zone. extra_headers: Send extra headers @@ -123,9 +167,13 @@ def get( return self._get( f"/zones/{zone_id}/url_normalization", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[URLNormalizationGetResponse]._unwrapper, ), - cast_to=URLNormalizationGetResponse, + cast_to=cast(Type[URLNormalizationGetResponse], ResultWrapper[URLNormalizationGetResponse]), ) @@ -153,8 +201,8 @@ async def update( self, *, zone_id: str, - scope: str | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + scope: Literal["incoming", "both"], + type: Literal["cloudflare", "rfc3986"], # 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, @@ -163,10 +211,10 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> URLNormalizationUpdateResponse: """ - Updates the URL normalization settings. + Updates the URL Normalization settings. Args: - zone_id: Identifier + zone_id: The unique ID of the zone. scope: The scope of the URL normalization. @@ -191,10 +239,50 @@ async def update( }, url_normalization_update_params.URLNormalizationUpdateParams, ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[URLNormalizationUpdateResponse]._unwrapper, + ), + cast_to=cast(Type[URLNormalizationUpdateResponse], ResultWrapper[URLNormalizationUpdateResponse]), + ) + + async def delete( + self, + *, + zone_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, + ) -> None: + """ + Deletes the URL Normalization settings. + + Args: + zone_id: The unique ID of the zone. + + 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 zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/zones/{zone_id}/url_normalization", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=URLNormalizationUpdateResponse, + cast_to=NoneType, ) async def get( @@ -209,10 +297,10 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> URLNormalizationGetResponse: """ - Fetches the current URL normalization settings. + Fetches the current URL Normalization settings. Args: - zone_id: Identifier + zone_id: The unique ID of the zone. extra_headers: Send extra headers @@ -227,9 +315,13 @@ async def get( return await self._get( f"/zones/{zone_id}/url_normalization", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[URLNormalizationGetResponse]._unwrapper, ), - cast_to=URLNormalizationGetResponse, + cast_to=cast(Type[URLNormalizationGetResponse], ResultWrapper[URLNormalizationGetResponse]), ) @@ -240,6 +332,9 @@ def __init__(self, url_normalization: URLNormalizationResource) -> None: self.update = to_raw_response_wrapper( url_normalization.update, ) + self.delete = to_raw_response_wrapper( + url_normalization.delete, + ) self.get = to_raw_response_wrapper( url_normalization.get, ) @@ -252,6 +347,9 @@ def __init__(self, url_normalization: AsyncURLNormalizationResource) -> None: self.update = async_to_raw_response_wrapper( url_normalization.update, ) + self.delete = async_to_raw_response_wrapper( + url_normalization.delete, + ) self.get = async_to_raw_response_wrapper( url_normalization.get, ) @@ -264,6 +362,9 @@ def __init__(self, url_normalization: URLNormalizationResource) -> None: self.update = to_streamed_response_wrapper( url_normalization.update, ) + self.delete = to_streamed_response_wrapper( + url_normalization.delete, + ) self.get = to_streamed_response_wrapper( url_normalization.get, ) @@ -276,6 +377,9 @@ def __init__(self, url_normalization: AsyncURLNormalizationResource) -> None: self.update = async_to_streamed_response_wrapper( url_normalization.update, ) + self.delete = async_to_streamed_response_wrapper( + url_normalization.delete, + ) self.get = async_to_streamed_response_wrapper( url_normalization.get, ) diff --git a/src/cloudflare/resources/url_scanner/responses.py b/src/cloudflare/resources/url_scanner/responses.py index cc0beef4e57..322e44344bc 100644 --- a/src/cloudflare/resources/url_scanner/responses.py +++ b/src/cloudflare/resources/url_scanner/responses.py @@ -56,7 +56,7 @@ def get( will be returned. Args: - account_id: Account Id. + account_id: Account ID. response_id: Response hash. @@ -120,7 +120,7 @@ async def get( will be returned. Args: - account_id: Account Id. + account_id: Account ID. response_id: Response hash. diff --git a/src/cloudflare/resources/url_scanner/scans.py b/src/cloudflare/resources/url_scanner/scans.py index a060414acce..dc22dbddda8 100644 --- a/src/cloudflare/resources/url_scanner/scans.py +++ b/src/cloudflare/resources/url_scanner/scans.py @@ -62,8 +62,8 @@ def with_streaming_response(self) -> ScansResourceWithStreamingResponse: def create( self, - account_id: str, *, + account_id: str, url: str, customagent: str | NotGiven = NOT_GIVEN, custom_headers: Dict[str, str] | NotGiven = NOT_GIVEN, @@ -83,7 +83,7 @@ def create( https://developers.cloudflare.com/security-center/investigate/scan-limits/. Args: - account_id: Account Id. + account_id: Account ID. custom_headers: Set custom headers. @@ -130,8 +130,8 @@ def create( def list( self, - account_id: str, *, + account_id: str, q: str | NotGiven = NOT_GIVEN, size: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -155,7 +155,7 @@ def list( with the given hash was downloaded. Args: - account_id: Account Id. + account_id: Account ID. q: Filter scans @@ -191,8 +191,8 @@ def list( def bulk_create( self, - account_id: str, *, + account_id: str, body: Iterable[scan_bulk_create_params.Body], # 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. @@ -209,7 +209,7 @@ def bulk_create( longer to finish. Args: - account_id: Account Id. + account_id: Account ID. body: List of urls to scan (up to a 100). @@ -249,9 +249,9 @@ def dom( Chrome. Args: - account_id: Account Id. + account_id: Account ID. - scan_id: Scan uuid. + scan_id: Scan UUID. extra_headers: Send extra headers @@ -290,9 +290,9 @@ def get( Get URL scan by uuid Args: - account_id: Account Id. + account_id: Account ID. - scan_id: Scan uuid. + scan_id: Scan UUID. extra_headers: Send extra headers @@ -332,9 +332,9 @@ def har( http://www.softwareishard.com/blog/har-12-spec/. Args: - account_id: Account Id. + account_id: Account ID. - scan_id: Scan uuid. + scan_id: Scan UUID. extra_headers: Send extra headers @@ -373,9 +373,9 @@ def screenshot( Get scan's screenshot by resolution (desktop/mobile/tablet). Args: - account_id: Account Id. + account_id: Account ID. - scan_id: Scan uuid. + scan_id: Scan UUID. resolution: Target device type. @@ -427,8 +427,8 @@ def with_streaming_response(self) -> AsyncScansResourceWithStreamingResponse: async def create( self, - account_id: str, *, + account_id: str, url: str, customagent: str | NotGiven = NOT_GIVEN, custom_headers: Dict[str, str] | NotGiven = NOT_GIVEN, @@ -448,7 +448,7 @@ async def create( https://developers.cloudflare.com/security-center/investigate/scan-limits/. Args: - account_id: Account Id. + account_id: Account ID. custom_headers: Set custom headers. @@ -495,8 +495,8 @@ async def create( async def list( self, - account_id: str, *, + account_id: str, q: str | NotGiven = NOT_GIVEN, size: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -520,7 +520,7 @@ async def list( with the given hash was downloaded. Args: - account_id: Account Id. + account_id: Account ID. q: Filter scans @@ -556,8 +556,8 @@ async def list( async def bulk_create( self, - account_id: str, *, + account_id: str, body: Iterable[scan_bulk_create_params.Body], # 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. @@ -574,7 +574,7 @@ async def bulk_create( longer to finish. Args: - account_id: Account Id. + account_id: Account ID. body: List of urls to scan (up to a 100). @@ -614,9 +614,9 @@ async def dom( Chrome. Args: - account_id: Account Id. + account_id: Account ID. - scan_id: Scan uuid. + scan_id: Scan UUID. extra_headers: Send extra headers @@ -655,9 +655,9 @@ async def get( Get URL scan by uuid Args: - account_id: Account Id. + account_id: Account ID. - scan_id: Scan uuid. + scan_id: Scan UUID. extra_headers: Send extra headers @@ -697,9 +697,9 @@ async def har( http://www.softwareishard.com/blog/har-12-spec/. Args: - account_id: Account Id. + account_id: Account ID. - scan_id: Scan uuid. + scan_id: Scan UUID. extra_headers: Send extra headers @@ -738,9 +738,9 @@ async def screenshot( Get scan's screenshot by resolution (desktop/mobile/tablet). Args: - account_id: Account Id. + account_id: Account ID. - scan_id: Scan uuid. + scan_id: Scan UUID. resolution: Target device type. diff --git a/src/cloudflare/resources/vectorize/indexes/indexes.py b/src/cloudflare/resources/vectorize/indexes/indexes.py index c6529e277b6..f0f19510cce 100644 --- a/src/cloudflare/resources/vectorize/indexes/indexes.py +++ b/src/cloudflare/resources/vectorize/indexes/indexes.py @@ -175,7 +175,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IndexDeleteResponse: + ) -> Optional[IndexDeleteResponse]: """ Deletes the specified Vectorize Index. @@ -195,7 +195,7 @@ def delete( if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return cast( - IndexDeleteResponse, + Optional[IndexDeleteResponse], self._delete( f"/accounts/{account_id}/vectorize/v2/indexes/{index_name}", options=make_request_options( @@ -203,7 +203,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[IndexDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[IndexDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[IndexDeleteResponse] @@ -687,7 +687,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IndexDeleteResponse: + ) -> Optional[IndexDeleteResponse]: """ Deletes the specified Vectorize Index. @@ -707,7 +707,7 @@ async def delete( if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return cast( - IndexDeleteResponse, + Optional[IndexDeleteResponse], await self._delete( f"/accounts/{account_id}/vectorize/v2/indexes/{index_name}", options=make_request_options( @@ -715,7 +715,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[IndexDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[IndexDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[IndexDeleteResponse] diff --git a/src/cloudflare/resources/waiting_rooms/waiting_rooms.py b/src/cloudflare/resources/waiting_rooms/waiting_rooms.py index a7a4308e856..4b9c83a3687 100644 --- a/src/cloudflare/resources/waiting_rooms/waiting_rooms.py +++ b/src/cloudflare/resources/waiting_rooms/waiting_rooms.py @@ -180,6 +180,9 @@ def create( queueing_status_code: Literal[200, 202, 429] | NotGiven = NOT_GIVEN, session_duration: int | NotGiven = NOT_GIVEN, suspended: bool | NotGiven = NOT_GIVEN, + turnstile_action: Literal["log", "infinite_queue"] | NotGiven = NOT_GIVEN, + turnstile_mode: Literal["off", "invisible", "visible_non_interactive", "visible_managed"] + | 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, @@ -451,6 +454,18 @@ def create( suspended: Suspends or allows traffic going to the waiting room. If set to `true`, the traffic will not go to the waiting room. + turnstile_action: Which action to take when a bot is detected using Turnstile. `log` will have no + impact on queueing behavior, simply keeping track of how many bots are detected + in Waiting Room Analytics. `infinite_queue` will send bots to a false queueing + state, where they will never reach your origin. `infinite_queue` requires + Advanced Waiting Room. + + turnstile_mode: Which Turnstile widget type to use for detecting bot traffic. See + [the Turnstile documentation](https://developers.cloudflare.com/turnstile/concepts/widget/#widget-types) + for the definitions of these widget types. Set to `off` to disable the Turnstile + integration entirely. Setting this to anything other than `off` or `invisible` + requires Advanced Waiting Room. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -484,6 +499,8 @@ def create( "queueing_status_code": queueing_status_code, "session_duration": session_duration, "suspended": suspended, + "turnstile_action": turnstile_action, + "turnstile_mode": turnstile_mode, }, waiting_room_create_params.WaitingRoomCreateParams, ), @@ -561,6 +578,9 @@ def update( queueing_status_code: Literal[200, 202, 429] | NotGiven = NOT_GIVEN, session_duration: int | NotGiven = NOT_GIVEN, suspended: bool | NotGiven = NOT_GIVEN, + turnstile_action: Literal["log", "infinite_queue"] | NotGiven = NOT_GIVEN, + turnstile_mode: Literal["off", "invisible", "visible_non_interactive", "visible_managed"] + | 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, @@ -832,6 +852,18 @@ def update( suspended: Suspends or allows traffic going to the waiting room. If set to `true`, the traffic will not go to the waiting room. + turnstile_action: Which action to take when a bot is detected using Turnstile. `log` will have no + impact on queueing behavior, simply keeping track of how many bots are detected + in Waiting Room Analytics. `infinite_queue` will send bots to a false queueing + state, where they will never reach your origin. `infinite_queue` requires + Advanced Waiting Room. + + turnstile_mode: Which Turnstile widget type to use for detecting bot traffic. See + [the Turnstile documentation](https://developers.cloudflare.com/turnstile/concepts/widget/#widget-types) + for the definitions of these widget types. Set to `off` to disable the Turnstile + integration entirely. Setting this to anything other than `off` or `invisible` + requires Advanced Waiting Room. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -867,6 +899,8 @@ def update( "queueing_status_code": queueing_status_code, "session_duration": session_duration, "suspended": suspended, + "turnstile_action": turnstile_action, + "turnstile_mode": turnstile_mode, }, waiting_room_update_params.WaitingRoomUpdateParams, ), @@ -1038,6 +1072,9 @@ def edit( queueing_status_code: Literal[200, 202, 429] | NotGiven = NOT_GIVEN, session_duration: int | NotGiven = NOT_GIVEN, suspended: bool | NotGiven = NOT_GIVEN, + turnstile_action: Literal["log", "infinite_queue"] | NotGiven = NOT_GIVEN, + turnstile_mode: Literal["off", "invisible", "visible_non_interactive", "visible_managed"] + | 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, @@ -1309,6 +1346,18 @@ def edit( suspended: Suspends or allows traffic going to the waiting room. If set to `true`, the traffic will not go to the waiting room. + turnstile_action: Which action to take when a bot is detected using Turnstile. `log` will have no + impact on queueing behavior, simply keeping track of how many bots are detected + in Waiting Room Analytics. `infinite_queue` will send bots to a false queueing + state, where they will never reach your origin. `infinite_queue` requires + Advanced Waiting Room. + + turnstile_mode: Which Turnstile widget type to use for detecting bot traffic. See + [the Turnstile documentation](https://developers.cloudflare.com/turnstile/concepts/widget/#widget-types) + for the definitions of these widget types. Set to `off` to disable the Turnstile + integration entirely. Setting this to anything other than `off` or `invisible` + requires Advanced Waiting Room. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1344,6 +1393,8 @@ def edit( "queueing_status_code": queueing_status_code, "session_duration": session_duration, "suspended": suspended, + "turnstile_action": turnstile_action, + "turnstile_mode": turnstile_mode, }, waiting_room_edit_params.WaitingRoomEditParams, ), @@ -1503,6 +1554,9 @@ async def create( queueing_status_code: Literal[200, 202, 429] | NotGiven = NOT_GIVEN, session_duration: int | NotGiven = NOT_GIVEN, suspended: bool | NotGiven = NOT_GIVEN, + turnstile_action: Literal["log", "infinite_queue"] | NotGiven = NOT_GIVEN, + turnstile_mode: Literal["off", "invisible", "visible_non_interactive", "visible_managed"] + | 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, @@ -1774,6 +1828,18 @@ async def create( suspended: Suspends or allows traffic going to the waiting room. If set to `true`, the traffic will not go to the waiting room. + turnstile_action: Which action to take when a bot is detected using Turnstile. `log` will have no + impact on queueing behavior, simply keeping track of how many bots are detected + in Waiting Room Analytics. `infinite_queue` will send bots to a false queueing + state, where they will never reach your origin. `infinite_queue` requires + Advanced Waiting Room. + + turnstile_mode: Which Turnstile widget type to use for detecting bot traffic. See + [the Turnstile documentation](https://developers.cloudflare.com/turnstile/concepts/widget/#widget-types) + for the definitions of these widget types. Set to `off` to disable the Turnstile + integration entirely. Setting this to anything other than `off` or `invisible` + requires Advanced Waiting Room. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1807,6 +1873,8 @@ async def create( "queueing_status_code": queueing_status_code, "session_duration": session_duration, "suspended": suspended, + "turnstile_action": turnstile_action, + "turnstile_mode": turnstile_mode, }, waiting_room_create_params.WaitingRoomCreateParams, ), @@ -1884,6 +1952,9 @@ async def update( queueing_status_code: Literal[200, 202, 429] | NotGiven = NOT_GIVEN, session_duration: int | NotGiven = NOT_GIVEN, suspended: bool | NotGiven = NOT_GIVEN, + turnstile_action: Literal["log", "infinite_queue"] | NotGiven = NOT_GIVEN, + turnstile_mode: Literal["off", "invisible", "visible_non_interactive", "visible_managed"] + | 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, @@ -2155,6 +2226,18 @@ async def update( suspended: Suspends or allows traffic going to the waiting room. If set to `true`, the traffic will not go to the waiting room. + turnstile_action: Which action to take when a bot is detected using Turnstile. `log` will have no + impact on queueing behavior, simply keeping track of how many bots are detected + in Waiting Room Analytics. `infinite_queue` will send bots to a false queueing + state, where they will never reach your origin. `infinite_queue` requires + Advanced Waiting Room. + + turnstile_mode: Which Turnstile widget type to use for detecting bot traffic. See + [the Turnstile documentation](https://developers.cloudflare.com/turnstile/concepts/widget/#widget-types) + for the definitions of these widget types. Set to `off` to disable the Turnstile + integration entirely. Setting this to anything other than `off` or `invisible` + requires Advanced Waiting Room. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -2190,6 +2273,8 @@ async def update( "queueing_status_code": queueing_status_code, "session_duration": session_duration, "suspended": suspended, + "turnstile_action": turnstile_action, + "turnstile_mode": turnstile_mode, }, waiting_room_update_params.WaitingRoomUpdateParams, ), @@ -2361,6 +2446,9 @@ async def edit( queueing_status_code: Literal[200, 202, 429] | NotGiven = NOT_GIVEN, session_duration: int | NotGiven = NOT_GIVEN, suspended: bool | NotGiven = NOT_GIVEN, + turnstile_action: Literal["log", "infinite_queue"] | NotGiven = NOT_GIVEN, + turnstile_mode: Literal["off", "invisible", "visible_non_interactive", "visible_managed"] + | 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, @@ -2632,6 +2720,18 @@ async def edit( suspended: Suspends or allows traffic going to the waiting room. If set to `true`, the traffic will not go to the waiting room. + turnstile_action: Which action to take when a bot is detected using Turnstile. `log` will have no + impact on queueing behavior, simply keeping track of how many bots are detected + in Waiting Room Analytics. `infinite_queue` will send bots to a false queueing + state, where they will never reach your origin. `infinite_queue` requires + Advanced Waiting Room. + + turnstile_mode: Which Turnstile widget type to use for detecting bot traffic. See + [the Turnstile documentation](https://developers.cloudflare.com/turnstile/concepts/widget/#widget-types) + for the definitions of these widget types. Set to `off` to disable the Turnstile + integration entirely. Setting this to anything other than `off` or `invisible` + requires Advanced Waiting Room. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -2667,6 +2767,8 @@ async def edit( "queueing_status_code": queueing_status_code, "session_duration": session_duration, "suspended": suspended, + "turnstile_action": turnstile_action, + "turnstile_mode": turnstile_mode, }, waiting_room_edit_params.WaitingRoomEditParams, ), diff --git a/src/cloudflare/resources/workers/__init__.py b/src/cloudflare/resources/workers/__init__.py index dea7e3e0167..2009583bd8f 100644 --- a/src/cloudflare/resources/workers/__init__.py +++ b/src/cloudflare/resources/workers/__init__.py @@ -1,13 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .ai import ( - AIResource, - AsyncAIResource, - AIResourceWithRawResponse, - AsyncAIResourceWithRawResponse, - AIResourceWithStreamingResponse, - AsyncAIResourceWithStreamingResponse, -) from .assets import ( AssetsResource, AsyncAssetsResource, @@ -16,6 +8,14 @@ AssetsResourceWithStreamingResponse, AsyncAssetsResourceWithStreamingResponse, ) +from .routes import ( + RoutesResource, + AsyncRoutesResource, + RoutesResourceWithRawResponse, + AsyncRoutesResourceWithRawResponse, + RoutesResourceWithStreamingResponse, + AsyncRoutesResourceWithStreamingResponse, +) from .domains import ( DomainsResource, AsyncDomainsResource, @@ -58,12 +58,12 @@ ) __all__ = [ - "AIResource", - "AsyncAIResource", - "AIResourceWithRawResponse", - "AsyncAIResourceWithRawResponse", - "AIResourceWithStreamingResponse", - "AsyncAIResourceWithStreamingResponse", + "RoutesResource", + "AsyncRoutesResource", + "RoutesResourceWithRawResponse", + "AsyncRoutesResourceWithRawResponse", + "RoutesResourceWithStreamingResponse", + "AsyncRoutesResourceWithStreamingResponse", "AssetsResource", "AsyncAssetsResource", "AssetsResourceWithRawResponse", diff --git a/src/cloudflare/resources/workers/ai/__init__.py b/src/cloudflare/resources/workers/ai/__init__.py deleted file mode 100644 index 4921cf245a4..00000000000 --- a/src/cloudflare/resources/workers/ai/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .ai import ( - AIResource, - AsyncAIResource, - AIResourceWithRawResponse, - AsyncAIResourceWithRawResponse, - AIResourceWithStreamingResponse, - AsyncAIResourceWithStreamingResponse, -) -from .models import ( - ModelsResource, - AsyncModelsResource, - ModelsResourceWithRawResponse, - AsyncModelsResourceWithRawResponse, - ModelsResourceWithStreamingResponse, - AsyncModelsResourceWithStreamingResponse, -) - -__all__ = [ - "ModelsResource", - "AsyncModelsResource", - "ModelsResourceWithRawResponse", - "AsyncModelsResourceWithRawResponse", - "ModelsResourceWithStreamingResponse", - "AsyncModelsResourceWithStreamingResponse", - "AIResource", - "AsyncAIResource", - "AIResourceWithRawResponse", - "AsyncAIResourceWithRawResponse", - "AIResourceWithStreamingResponse", - "AsyncAIResourceWithStreamingResponse", -] diff --git a/src/cloudflare/resources/workers/ai/models/models.py b/src/cloudflare/resources/workers/ai/models/models.py deleted file mode 100644 index 95e2e20f66f..00000000000 --- a/src/cloudflare/resources/workers/ai/models/models.py +++ /dev/null @@ -1,102 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .schema import ( - SchemaResource, - AsyncSchemaResource, - SchemaResourceWithRawResponse, - AsyncSchemaResourceWithRawResponse, - SchemaResourceWithStreamingResponse, - AsyncSchemaResourceWithStreamingResponse, -) -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource - -__all__ = ["ModelsResource", "AsyncModelsResource"] - - -class ModelsResource(SyncAPIResource): - @cached_property - def schema(self) -> SchemaResource: - return SchemaResource(self._client) - - @cached_property - def with_raw_response(self) -> ModelsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers - """ - return ModelsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ModelsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response - """ - return ModelsResourceWithStreamingResponse(self) - - -class AsyncModelsResource(AsyncAPIResource): - @cached_property - def schema(self) -> AsyncSchemaResource: - return AsyncSchemaResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncModelsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers - """ - return AsyncModelsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncModelsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response - """ - return AsyncModelsResourceWithStreamingResponse(self) - - -class ModelsResourceWithRawResponse: - def __init__(self, models: ModelsResource) -> None: - self._models = models - - @cached_property - def schema(self) -> SchemaResourceWithRawResponse: - return SchemaResourceWithRawResponse(self._models.schema) - - -class AsyncModelsResourceWithRawResponse: - def __init__(self, models: AsyncModelsResource) -> None: - self._models = models - - @cached_property - def schema(self) -> AsyncSchemaResourceWithRawResponse: - return AsyncSchemaResourceWithRawResponse(self._models.schema) - - -class ModelsResourceWithStreamingResponse: - def __init__(self, models: ModelsResource) -> None: - self._models = models - - @cached_property - def schema(self) -> SchemaResourceWithStreamingResponse: - return SchemaResourceWithStreamingResponse(self._models.schema) - - -class AsyncModelsResourceWithStreamingResponse: - def __init__(self, models: AsyncModelsResource) -> None: - self._models = models - - @cached_property - def schema(self) -> AsyncSchemaResourceWithStreamingResponse: - return AsyncSchemaResourceWithStreamingResponse(self._models.schema) diff --git a/src/cloudflare/resources/workers/assets/upload.py b/src/cloudflare/resources/workers/assets/upload.py index 1572f007c5f..ecc8a178557 100644 --- a/src/cloudflare/resources/workers/assets/upload.py +++ b/src/cloudflare/resources/workers/assets/upload.py @@ -61,8 +61,11 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[UploadCreateResponse]: - """ - Upload assets ahead of creating a Worker version. + """Upload assets ahead of creating a Worker version. + + To learn more about the direct + uploads of assets, see + https://developers.cloudflare.com/workers/static-assets/direct-upload/ Args: account_id: Identifier @@ -134,8 +137,11 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[UploadCreateResponse]: - """ - Upload assets ahead of creating a Worker version. + """Upload assets ahead of creating a Worker version. + + To learn more about the direct + uploads of assets, see + https://developers.cloudflare.com/workers/static-assets/direct-upload/ Args: account_id: Identifier diff --git a/src/cloudflare/resources/workers/routes.py b/src/cloudflare/resources/workers/routes.py new file mode 100644 index 00000000000..7af10337af1 --- /dev/null +++ b/src/cloudflare/resources/workers/routes.py @@ -0,0 +1,600 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Type, Optional, cast + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import ( + maybe_transform, + async_maybe_transform, +) +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage +from ..._base_client import AsyncPaginator, make_request_options +from ...types.workers import route_create_params, route_update_params +from ...types.workers.route_get_response import RouteGetResponse +from ...types.workers.route_list_response import RouteListResponse +from ...types.workers.route_create_response import RouteCreateResponse +from ...types.workers.route_delete_response import RouteDeleteResponse +from ...types.workers.route_update_response import RouteUpdateResponse + +__all__ = ["RoutesResource", "AsyncRoutesResource"] + + +class RoutesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RoutesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return RoutesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RoutesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return RoutesResourceWithStreamingResponse(self) + + def create( + self, + *, + zone_id: str, + pattern: str, + script: 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, + ) -> RouteCreateResponse: + """ + Creates a route that maps a URL pattern to a Worker. + + Args: + zone_id: Identifier + + script: Name of the script, used in URLs and route configuration. + + 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 zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return self._post( + f"/zones/{zone_id}/workers/routes", + body=maybe_transform( + { + "pattern": pattern, + "script": script, + }, + route_create_params.RouteCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RouteCreateResponse, + ) + + def update( + self, + route_id: str, + *, + zone_id: str, + pattern: str, + script: 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, + ) -> Optional[RouteUpdateResponse]: + """ + Updates the URL pattern or Worker associated with a route. + + Args: + zone_id: Identifier + + route_id: Identifier + + script: Name of the script, used in URLs and route configuration. + + 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 zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return self._put( + f"/zones/{zone_id}/workers/routes/{route_id}", + body=maybe_transform( + { + "pattern": pattern, + "script": script, + }, + route_update_params.RouteUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RouteUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RouteUpdateResponse]], ResultWrapper[RouteUpdateResponse]), + ) + + def list( + self, + *, + zone_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncSinglePage[RouteListResponse]: + """ + Returns routes for a zone. + + Args: + zone_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 zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return self._get_api_list( + f"/zones/{zone_id}/workers/routes", + page=SyncSinglePage[RouteListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=RouteListResponse, + ) + + def delete( + self, + route_id: str, + *, + zone_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, + ) -> RouteDeleteResponse: + """ + Deletes a route. + + Args: + zone_id: Identifier + + route_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 zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return self._delete( + f"/zones/{zone_id}/workers/routes/{route_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RouteDeleteResponse, + ) + + def get( + self, + route_id: str, + *, + zone_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[RouteGetResponse]: + """ + Returns information about a route, including URL pattern and Worker. + + Args: + zone_id: Identifier + + route_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 zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return self._get( + f"/zones/{zone_id}/workers/routes/{route_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RouteGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RouteGetResponse]], ResultWrapper[RouteGetResponse]), + ) + + +class AsyncRoutesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRoutesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncRoutesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRoutesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncRoutesResourceWithStreamingResponse(self) + + async def create( + self, + *, + zone_id: str, + pattern: str, + script: 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, + ) -> RouteCreateResponse: + """ + Creates a route that maps a URL pattern to a Worker. + + Args: + zone_id: Identifier + + script: Name of the script, used in URLs and route configuration. + + 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 zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return await self._post( + f"/zones/{zone_id}/workers/routes", + body=await async_maybe_transform( + { + "pattern": pattern, + "script": script, + }, + route_create_params.RouteCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RouteCreateResponse, + ) + + async def update( + self, + route_id: str, + *, + zone_id: str, + pattern: str, + script: 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, + ) -> Optional[RouteUpdateResponse]: + """ + Updates the URL pattern or Worker associated with a route. + + Args: + zone_id: Identifier + + route_id: Identifier + + script: Name of the script, used in URLs and route configuration. + + 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 zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return await self._put( + f"/zones/{zone_id}/workers/routes/{route_id}", + body=await async_maybe_transform( + { + "pattern": pattern, + "script": script, + }, + route_update_params.RouteUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RouteUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RouteUpdateResponse]], ResultWrapper[RouteUpdateResponse]), + ) + + def list( + self, + *, + zone_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[RouteListResponse, AsyncSinglePage[RouteListResponse]]: + """ + Returns routes for a zone. + + Args: + zone_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 zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return self._get_api_list( + f"/zones/{zone_id}/workers/routes", + page=AsyncSinglePage[RouteListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=RouteListResponse, + ) + + async def delete( + self, + route_id: str, + *, + zone_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, + ) -> RouteDeleteResponse: + """ + Deletes a route. + + Args: + zone_id: Identifier + + route_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 zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return await self._delete( + f"/zones/{zone_id}/workers/routes/{route_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RouteDeleteResponse, + ) + + async def get( + self, + route_id: str, + *, + zone_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[RouteGetResponse]: + """ + Returns information about a route, including URL pattern and Worker. + + Args: + zone_id: Identifier + + route_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 zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return await self._get( + f"/zones/{zone_id}/workers/routes/{route_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RouteGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RouteGetResponse]], ResultWrapper[RouteGetResponse]), + ) + + +class RoutesResourceWithRawResponse: + def __init__(self, routes: RoutesResource) -> None: + self._routes = routes + + self.create = to_raw_response_wrapper( + routes.create, + ) + self.update = to_raw_response_wrapper( + routes.update, + ) + self.list = to_raw_response_wrapper( + routes.list, + ) + self.delete = to_raw_response_wrapper( + routes.delete, + ) + self.get = to_raw_response_wrapper( + routes.get, + ) + + +class AsyncRoutesResourceWithRawResponse: + def __init__(self, routes: AsyncRoutesResource) -> None: + self._routes = routes + + self.create = async_to_raw_response_wrapper( + routes.create, + ) + self.update = async_to_raw_response_wrapper( + routes.update, + ) + self.list = async_to_raw_response_wrapper( + routes.list, + ) + self.delete = async_to_raw_response_wrapper( + routes.delete, + ) + self.get = async_to_raw_response_wrapper( + routes.get, + ) + + +class RoutesResourceWithStreamingResponse: + def __init__(self, routes: RoutesResource) -> None: + self._routes = routes + + self.create = to_streamed_response_wrapper( + routes.create, + ) + self.update = to_streamed_response_wrapper( + routes.update, + ) + self.list = to_streamed_response_wrapper( + routes.list, + ) + self.delete = to_streamed_response_wrapper( + routes.delete, + ) + self.get = to_streamed_response_wrapper( + routes.get, + ) + + +class AsyncRoutesResourceWithStreamingResponse: + def __init__(self, routes: AsyncRoutesResource) -> None: + self._routes = routes + + self.create = async_to_streamed_response_wrapper( + routes.create, + ) + self.update = async_to_streamed_response_wrapper( + routes.update, + ) + self.list = async_to_streamed_response_wrapper( + routes.list, + ) + self.delete = async_to_streamed_response_wrapper( + routes.delete, + ) + self.get = async_to_streamed_response_wrapper( + routes.get, + ) diff --git a/src/cloudflare/resources/workers/scripts/assets/upload.py b/src/cloudflare/resources/workers/scripts/assets/upload.py index 711cf2035d4..836583e47f4 100644 --- a/src/cloudflare/resources/workers/scripts/assets/upload.py +++ b/src/cloudflare/resources/workers/scripts/assets/upload.py @@ -60,8 +60,11 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[UploadCreateResponse]: - """ - Start uploading a collection of assets for use in a Worker version. + """Start uploading a collection of assets for use in a Worker version. + + To learn + more about the direct uploads of assets, see + https://developers.cloudflare.com/workers/static-assets/direct-upload/ Args: account_id: Identifier @@ -130,8 +133,11 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[UploadCreateResponse]: - """ - Start uploading a collection of assets for use in a Worker version. + """Start uploading a collection of assets for use in a Worker version. + + To learn + more about the direct uploads of assets, see + https://developers.cloudflare.com/workers/static-assets/direct-upload/ Args: account_id: Identifier diff --git a/src/cloudflare/resources/workers/scripts/content.py b/src/cloudflare/resources/workers/scripts/content.py index b4c91d83d61..09d1d506899 100644 --- a/src/cloudflare/resources/workers/scripts/content.py +++ b/src/cloudflare/resources/workers/scripts/content.py @@ -2,16 +2,14 @@ from __future__ import annotations -from typing import List, Type, Mapping, Optional, cast +from typing import Type, Optional, cast import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( - extract_files, maybe_transform, strip_not_given, - deepcopy_minimal, async_maybe_transform, ) from ...._compat import cached_property @@ -64,8 +62,7 @@ def update( script_name: str, *, account_id: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN, + metadata: WorkerMetadataParam, cf_worker_body_part: str | NotGiven = NOT_GIVEN, cf_worker_main_module_part: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -83,13 +80,6 @@ def update( script_name: Name of the script, used in URLs and route configuration. - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be - present. This should be referenced either in the metadata as `main_module` - (esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART` - (esm) /`CF-WORKER-BODY-PART` (service worker) by part name. Source maps may also - be included using the `application/source-map` content type. - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. extra_headers: Send extra headers @@ -113,21 +103,13 @@ def update( ), **(extra_headers or {}), } - body = deepcopy_minimal( - { - "any_part_name": any_part_name, - "metadata": metadata, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["", ""]]) # It should be noted that the actual Content-Type header that will be # sent to the server will contain a `boundary` parameter, e.g. # multipart/form-data; boundary=---abc-- extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return self._put( f"/accounts/{account_id}/workers/scripts/{script_name}/content", - body=maybe_transform(body, content_update_params.ContentUpdateParams), - files=files, + body=maybe_transform({"metadata": metadata}, content_update_params.ContentUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -205,8 +187,7 @@ async def update( script_name: str, *, account_id: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN, + metadata: WorkerMetadataParam, cf_worker_body_part: str | NotGiven = NOT_GIVEN, cf_worker_main_module_part: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -224,13 +205,6 @@ async def update( script_name: Name of the script, used in URLs and route configuration. - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be - present. This should be referenced either in the metadata as `main_module` - (esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART` - (esm) /`CF-WORKER-BODY-PART` (service worker) by part name. Source maps may also - be included using the `application/source-map` content type. - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. extra_headers: Send extra headers @@ -254,21 +228,13 @@ async def update( ), **(extra_headers or {}), } - body = deepcopy_minimal( - { - "any_part_name": any_part_name, - "metadata": metadata, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["", ""]]) # It should be noted that the actual Content-Type header that will be # sent to the server will contain a `boundary` parameter, e.g. # multipart/form-data; boundary=---abc-- extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return await self._put( f"/accounts/{account_id}/workers/scripts/{script_name}/content", - body=await async_maybe_transform(body, content_update_params.ContentUpdateParams), - files=files, + body=await async_maybe_transform({"metadata": metadata}, content_update_params.ContentUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/workers/scripts/scripts.py b/src/cloudflare/resources/workers/scripts/scripts.py index ffc9db763a4..5164db2723c 100644 --- a/src/cloudflare/resources/workers/scripts/scripts.py +++ b/src/cloudflare/resources/workers/scripts/scripts.py @@ -2,8 +2,7 @@ from __future__ import annotations -from typing import List, Type, Optional, cast -from typing_extensions import overload +from typing import Type, Optional, cast import httpx @@ -39,9 +38,8 @@ VersionsResourceWithStreamingResponse, AsyncVersionsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileTypes +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven from ...._utils import ( - required_args, maybe_transform, async_maybe_transform, ) @@ -72,18 +70,10 @@ ) from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( - BinaryAPIResponse, - AsyncBinaryAPIResponse, - StreamedBinaryAPIResponse, - AsyncStreamedBinaryAPIResponse, to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, - to_custom_raw_response_wrapper, async_to_streamed_response_wrapper, - to_custom_streamed_response_wrapper, - async_to_custom_raw_response_wrapper, - async_to_custom_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper from ....pagination import SyncSinglePage, AsyncSinglePage @@ -155,15 +145,12 @@ def with_streaming_response(self) -> ScriptsResourceWithStreamingResponse: """ return ScriptsResourceWithStreamingResponse(self) - @overload def update( self, script_name: str, *, account_id: str, - rollback_to: str | NotGiven = NOT_GIVEN, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: script_update_params.Variant0Metadata | NotGiven = NOT_GIVEN, + metadata: script_update_params.Metadata, # 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, @@ -182,16 +169,6 @@ def update( script_name: Name of the script, used in URLs and route configuration. - rollback_to: Rollback to provided deployment based on deployment ID. Request body will only - parse a "message" part. You can learn more about deployments - [here](https://developers.cloudflare.com/workers/platform/deployments/). - - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be present - and referenced in the metadata as `main_module` or `body_part` by part name. - Source maps may also be included using the `application/source-map` content - type. - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. extra_headers: Send extra headers @@ -202,88 +179,18 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @overload - def update( - self, - script_name: str, - *, - account_id: str, - rollback_to: str | NotGiven = NOT_GIVEN, - message: 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, - ) -> Optional[ScriptUpdateResponse]: - """Upload a worker module. - - You can find more about the multipart metadata on our - docs: - https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/. - - Args: - account_id: Identifier - - script_name: Name of the script, used in URLs and route configuration. - - rollback_to: Rollback to provided deployment based on deployment ID. Request body will only - parse a "message" part. You can learn more about deployments - [here](https://developers.cloudflare.com/workers/platform/deployments/). - - message: Rollback message to be associated with this deployment. Only parsed when query - param `"rollback_to"` is present. - - 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 - """ - ... - - @required_args(["account_id"]) - def update( - self, - script_name: str, - *, - account_id: str, - rollback_to: str | NotGiven = NOT_GIVEN, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: script_update_params.Variant0Metadata | NotGiven = NOT_GIVEN, - message: 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, - ) -> Optional[ScriptUpdateResponse]: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not script_name: raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") return self._put( f"/accounts/{account_id}/workers/scripts/{script_name}", - body=maybe_transform( - { - "any_part_name": any_part_name, - "metadata": metadata, - "message": message, - }, - script_update_params.ScriptUpdateParams, - ), + body=maybe_transform({"metadata": metadata}, script_update_params.ScriptUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=maybe_transform({"rollback_to": rollback_to}, script_update_params.ScriptUpdateParams), post_parser=ResultWrapper[Optional[ScriptUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ScriptUpdateResponse]], ResultWrapper[ScriptUpdateResponse]), @@ -387,7 +294,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BinaryAPIResponse: + ) -> str: """Fetch raw script content for your worker. Note this is the original script @@ -410,13 +317,13 @@ def get( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not script_name: raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") - extra_headers = {"Accept": "undefined", **(extra_headers or {})} + extra_headers = {"Accept": "application/javascript", **(extra_headers or {})} return self._get( f"/accounts/{account_id}/workers/scripts/{script_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=BinaryAPIResponse, + cast_to=str, ) @@ -472,15 +379,12 @@ def with_streaming_response(self) -> AsyncScriptsResourceWithStreamingResponse: """ return AsyncScriptsResourceWithStreamingResponse(self) - @overload async def update( self, script_name: str, *, account_id: str, - rollback_to: str | NotGiven = NOT_GIVEN, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: script_update_params.Variant0Metadata | NotGiven = NOT_GIVEN, + metadata: script_update_params.Metadata, # 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, @@ -499,16 +403,6 @@ async def update( script_name: Name of the script, used in URLs and route configuration. - rollback_to: Rollback to provided deployment based on deployment ID. Request body will only - parse a "message" part. You can learn more about deployments - [here](https://developers.cloudflare.com/workers/platform/deployments/). - - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be present - and referenced in the metadata as `main_module` or `body_part` by part name. - Source maps may also be included using the `application/source-map` content - type. - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. extra_headers: Send extra headers @@ -519,90 +413,18 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @overload - async def update( - self, - script_name: str, - *, - account_id: str, - rollback_to: str | NotGiven = NOT_GIVEN, - message: 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, - ) -> Optional[ScriptUpdateResponse]: - """Upload a worker module. - - You can find more about the multipart metadata on our - docs: - https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/. - - Args: - account_id: Identifier - - script_name: Name of the script, used in URLs and route configuration. - - rollback_to: Rollback to provided deployment based on deployment ID. Request body will only - parse a "message" part. You can learn more about deployments - [here](https://developers.cloudflare.com/workers/platform/deployments/). - - message: Rollback message to be associated with this deployment. Only parsed when query - param `"rollback_to"` is present. - - 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 - """ - ... - - @required_args(["account_id"]) - async def update( - self, - script_name: str, - *, - account_id: str, - rollback_to: str | NotGiven = NOT_GIVEN, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: script_update_params.Variant0Metadata | NotGiven = NOT_GIVEN, - message: 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, - ) -> Optional[ScriptUpdateResponse]: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not script_name: raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") return await self._put( f"/accounts/{account_id}/workers/scripts/{script_name}", - body=await async_maybe_transform( - { - "any_part_name": any_part_name, - "metadata": metadata, - "message": message, - }, - script_update_params.ScriptUpdateParams, - ), + body=await async_maybe_transform({"metadata": metadata}, script_update_params.ScriptUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( - {"rollback_to": rollback_to}, script_update_params.ScriptUpdateParams - ), post_parser=ResultWrapper[Optional[ScriptUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ScriptUpdateResponse]], ResultWrapper[ScriptUpdateResponse]), @@ -706,7 +528,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncBinaryAPIResponse: + ) -> str: """Fetch raw script content for your worker. Note this is the original script @@ -729,13 +551,13 @@ async def get( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not script_name: raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") - extra_headers = {"Accept": "undefined", **(extra_headers or {})} + extra_headers = {"Accept": "application/javascript", **(extra_headers or {})} return await self._get( f"/accounts/{account_id}/workers/scripts/{script_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AsyncBinaryAPIResponse, + cast_to=str, ) @@ -752,9 +574,8 @@ def __init__(self, scripts: ScriptsResource) -> None: self.delete = to_raw_response_wrapper( scripts.delete, ) - self.get = to_custom_raw_response_wrapper( + self.get = to_raw_response_wrapper( scripts.get, - BinaryAPIResponse, ) @cached_property @@ -803,9 +624,8 @@ def __init__(self, scripts: AsyncScriptsResource) -> None: self.delete = async_to_raw_response_wrapper( scripts.delete, ) - self.get = async_to_custom_raw_response_wrapper( + self.get = async_to_raw_response_wrapper( scripts.get, - AsyncBinaryAPIResponse, ) @cached_property @@ -854,9 +674,8 @@ def __init__(self, scripts: ScriptsResource) -> None: self.delete = to_streamed_response_wrapper( scripts.delete, ) - self.get = to_custom_streamed_response_wrapper( + self.get = to_streamed_response_wrapper( scripts.get, - StreamedBinaryAPIResponse, ) @cached_property @@ -905,9 +724,8 @@ def __init__(self, scripts: AsyncScriptsResource) -> None: self.delete = async_to_streamed_response_wrapper( scripts.delete, ) - self.get = async_to_custom_streamed_response_wrapper( + self.get = async_to_streamed_response_wrapper( scripts.get, - AsyncStreamedBinaryAPIResponse, ) @cached_property diff --git a/src/cloudflare/resources/workers/scripts/versions.py b/src/cloudflare/resources/workers/scripts/versions.py index fa1bb14105f..749b4f83f55 100644 --- a/src/cloudflare/resources/workers/scripts/versions.py +++ b/src/cloudflare/resources/workers/scripts/versions.py @@ -2,15 +2,13 @@ from __future__ import annotations -from typing import List, Type, Mapping, Optional, cast +from typing import Type, Optional, cast import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( - extract_files, maybe_transform, - deepcopy_minimal, async_maybe_transform, ) from ...._compat import cached_property @@ -57,8 +55,7 @@ def create( script_name: str, *, account_id: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: version_create_params.Metadata | NotGiven = NOT_GIVEN, + metadata: version_create_params.Metadata, # 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, @@ -77,10 +74,6 @@ def create( script_name: Name of the script. - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be present - and referenced in the metadata as `main_module`. - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. extra_headers: Send extra headers @@ -95,21 +88,13 @@ def create( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not script_name: raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") - body = deepcopy_minimal( - { - "any_part_name": any_part_name, - "metadata": metadata, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["", ""]]) # It should be noted that the actual Content-Type header that will be # sent to the server will contain a `boundary` parameter, e.g. # multipart/form-data; boundary=---abc-- extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return self._post( f"/accounts/{account_id}/workers/scripts/{script_name}/versions", - body=maybe_transform(body, version_create_params.VersionCreateParams), - files=files, + body=maybe_transform({"metadata": metadata}, version_create_params.VersionCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -255,8 +240,7 @@ async def create( script_name: str, *, account_id: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: version_create_params.Metadata | NotGiven = NOT_GIVEN, + metadata: version_create_params.Metadata, # 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, @@ -275,10 +259,6 @@ async def create( script_name: Name of the script. - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be present - and referenced in the metadata as `main_module`. - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. extra_headers: Send extra headers @@ -293,21 +273,13 @@ async def create( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not script_name: raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") - body = deepcopy_minimal( - { - "any_part_name": any_part_name, - "metadata": metadata, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["", ""]]) # It should be noted that the actual Content-Type header that will be # sent to the server will contain a `boundary` parameter, e.g. # multipart/form-data; boundary=---abc-- extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return await self._post( f"/accounts/{account_id}/workers/scripts/{script_name}/versions", - body=await async_maybe_transform(body, version_create_params.VersionCreateParams), - files=files, + body=await async_maybe_transform({"metadata": metadata}, version_create_params.VersionCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/workers/workers.py b/src/cloudflare/resources/workers/workers.py index ed4da6b38d5..e167830c87d 100644 --- a/src/cloudflare/resources/workers/workers.py +++ b/src/cloudflare/resources/workers/workers.py @@ -2,13 +2,13 @@ from __future__ import annotations -from .ai.ai import ( - AIResource, - AsyncAIResource, - AIResourceWithRawResponse, - AsyncAIResourceWithRawResponse, - AIResourceWithStreamingResponse, - AsyncAIResourceWithStreamingResponse, +from .routes import ( + RoutesResource, + AsyncRoutesResource, + RoutesResourceWithRawResponse, + AsyncRoutesResourceWithRawResponse, + RoutesResourceWithStreamingResponse, + AsyncRoutesResourceWithStreamingResponse, ) from .domains import ( DomainsResource, @@ -58,8 +58,8 @@ class WorkersResource(SyncAPIResource): @cached_property - def ai(self) -> AIResource: - return AIResource(self._client) + def routes(self) -> RoutesResource: + return RoutesResource(self._client) @cached_property def assets(self) -> AssetsResource: @@ -103,8 +103,8 @@ def with_streaming_response(self) -> WorkersResourceWithStreamingResponse: class AsyncWorkersResource(AsyncAPIResource): @cached_property - def ai(self) -> AsyncAIResource: - return AsyncAIResource(self._client) + def routes(self) -> AsyncRoutesResource: + return AsyncRoutesResource(self._client) @cached_property def assets(self) -> AsyncAssetsResource: @@ -151,8 +151,8 @@ def __init__(self, workers: WorkersResource) -> None: self._workers = workers @cached_property - def ai(self) -> AIResourceWithRawResponse: - return AIResourceWithRawResponse(self._workers.ai) + def routes(self) -> RoutesResourceWithRawResponse: + return RoutesResourceWithRawResponse(self._workers.routes) @cached_property def assets(self) -> AssetsResourceWithRawResponse: @@ -180,8 +180,8 @@ def __init__(self, workers: AsyncWorkersResource) -> None: self._workers = workers @cached_property - def ai(self) -> AsyncAIResourceWithRawResponse: - return AsyncAIResourceWithRawResponse(self._workers.ai) + def routes(self) -> AsyncRoutesResourceWithRawResponse: + return AsyncRoutesResourceWithRawResponse(self._workers.routes) @cached_property def assets(self) -> AsyncAssetsResourceWithRawResponse: @@ -209,8 +209,8 @@ def __init__(self, workers: WorkersResource) -> None: self._workers = workers @cached_property - def ai(self) -> AIResourceWithStreamingResponse: - return AIResourceWithStreamingResponse(self._workers.ai) + def routes(self) -> RoutesResourceWithStreamingResponse: + return RoutesResourceWithStreamingResponse(self._workers.routes) @cached_property def assets(self) -> AssetsResourceWithStreamingResponse: @@ -238,8 +238,8 @@ def __init__(self, workers: AsyncWorkersResource) -> None: self._workers = workers @cached_property - def ai(self) -> AsyncAIResourceWithStreamingResponse: - return AsyncAIResourceWithStreamingResponse(self._workers.ai) + def routes(self) -> AsyncRoutesResourceWithStreamingResponse: + return AsyncRoutesResourceWithStreamingResponse(self._workers.routes) @cached_property def assets(self) -> AsyncAssetsResourceWithStreamingResponse: diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/__init__.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/__init__.py index fd5a962f515..668f9921146 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/__init__.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/__init__.py @@ -48,8 +48,22 @@ SettingsResourceWithStreamingResponse, AsyncSettingsResourceWithStreamingResponse, ) +from .asset_upload import ( + AssetUploadResource, + AsyncAssetUploadResource, + AssetUploadResourceWithRawResponse, + AsyncAssetUploadResourceWithRawResponse, + AssetUploadResourceWithStreamingResponse, + AsyncAssetUploadResourceWithStreamingResponse, +) __all__ = [ + "AssetUploadResource", + "AsyncAssetUploadResource", + "AssetUploadResourceWithRawResponse", + "AsyncAssetUploadResourceWithRawResponse", + "AssetUploadResourceWithStreamingResponse", + "AsyncAssetUploadResourceWithStreamingResponse", "ContentResource", "AsyncContentResource", "ContentResourceWithRawResponse", diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/asset_upload.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/asset_upload.py new file mode 100644 index 00000000000..4b4e04a0a4e --- /dev/null +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/asset_upload.py @@ -0,0 +1,223 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Type, Optional, cast + +import httpx + +from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ......_utils import ( + maybe_transform, + async_maybe_transform, +) +from ......_compat import cached_property +from ......_resource import SyncAPIResource, AsyncAPIResource +from ......_response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ......_wrappers import ResultWrapper +from ......_base_client import make_request_options +from ......types.workers_for_platforms.dispatch.namespaces.scripts import asset_upload_create_params +from ......types.workers_for_platforms.dispatch.namespaces.scripts.asset_upload_create_response import ( + AssetUploadCreateResponse, +) + +__all__ = ["AssetUploadResource", "AsyncAssetUploadResource"] + + +class AssetUploadResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AssetUploadResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AssetUploadResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AssetUploadResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AssetUploadResourceWithStreamingResponse(self) + + def create( + self, + script_name: str, + *, + account_id: str, + dispatch_namespace: str, + manifest: Dict[str, asset_upload_create_params.Manifest] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[AssetUploadCreateResponse]: + """Start uploading a collection of assets for use in a Worker version. + + To learn + more about the direct uploads of assets, see + https://developers.cloudflare.com/workers/static-assets/direct-upload/ + + Args: + account_id: Identifier + + dispatch_namespace: Name of the Workers for Platforms dispatch namespace. + + script_name: Name of the script, used in URLs and route configuration. + + manifest: A manifest ([path]: {hash, size}) map of files to upload. As an example, + `/blog/hello-world.html` would be a valid path key. + + 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}") + if not script_name: + raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") + return self._post( + f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/assets-upload-session", + body=maybe_transform({"manifest": manifest}, asset_upload_create_params.AssetUploadCreateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AssetUploadCreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[AssetUploadCreateResponse]], ResultWrapper[AssetUploadCreateResponse]), + ) + + +class AsyncAssetUploadResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAssetUploadResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncAssetUploadResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAssetUploadResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncAssetUploadResourceWithStreamingResponse(self) + + async def create( + self, + script_name: str, + *, + account_id: str, + dispatch_namespace: str, + manifest: Dict[str, asset_upload_create_params.Manifest] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[AssetUploadCreateResponse]: + """Start uploading a collection of assets for use in a Worker version. + + To learn + more about the direct uploads of assets, see + https://developers.cloudflare.com/workers/static-assets/direct-upload/ + + Args: + account_id: Identifier + + dispatch_namespace: Name of the Workers for Platforms dispatch namespace. + + script_name: Name of the script, used in URLs and route configuration. + + manifest: A manifest ([path]: {hash, size}) map of files to upload. As an example, + `/blog/hello-world.html` would be a valid path key. + + 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}") + if not script_name: + raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") + return await self._post( + f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/assets-upload-session", + body=await async_maybe_transform( + {"manifest": manifest}, asset_upload_create_params.AssetUploadCreateParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AssetUploadCreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[AssetUploadCreateResponse]], ResultWrapper[AssetUploadCreateResponse]), + ) + + +class AssetUploadResourceWithRawResponse: + def __init__(self, asset_upload: AssetUploadResource) -> None: + self._asset_upload = asset_upload + + self.create = to_raw_response_wrapper( + asset_upload.create, + ) + + +class AsyncAssetUploadResourceWithRawResponse: + def __init__(self, asset_upload: AsyncAssetUploadResource) -> None: + self._asset_upload = asset_upload + + self.create = async_to_raw_response_wrapper( + asset_upload.create, + ) + + +class AssetUploadResourceWithStreamingResponse: + def __init__(self, asset_upload: AssetUploadResource) -> None: + self._asset_upload = asset_upload + + self.create = to_streamed_response_wrapper( + asset_upload.create, + ) + + +class AsyncAssetUploadResourceWithStreamingResponse: + def __init__(self, asset_upload: AsyncAssetUploadResource) -> None: + self._asset_upload = asset_upload + + self.create = async_to_streamed_response_wrapper( + asset_upload.create, + ) diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py index dd445795f95..48a6af6ffc6 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py @@ -2,16 +2,14 @@ from __future__ import annotations -from typing import List, Type, Mapping, Optional, cast +from typing import Type, Optional, cast import httpx -from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes +from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven from ......_utils import ( - extract_files, maybe_transform, strip_not_given, - deepcopy_minimal, async_maybe_transform, ) from ......_compat import cached_property @@ -65,8 +63,7 @@ def update( *, account_id: str, dispatch_namespace: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN, + metadata: WorkerMetadataParam, cf_worker_body_part: str | NotGiven = NOT_GIVEN, cf_worker_main_module_part: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -86,13 +83,6 @@ def update( script_name: Name of the script, used in URLs and route configuration. - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be - present. This should be referenced either in the metadata as `main_module` - (esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART` - (esm) /`CF-WORKER-BODY-PART` (service worker) by part name. Source maps may also - be included using the `application/source-map` content type. - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. extra_headers: Send extra headers @@ -118,21 +108,13 @@ def update( ), **(extra_headers or {}), } - body = deepcopy_minimal( - { - "any_part_name": any_part_name, - "metadata": metadata, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["", ""]]) # It should be noted that the actual Content-Type header that will be # sent to the server will contain a `boundary` parameter, e.g. # multipart/form-data; boundary=---abc-- extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return self._put( f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/content", - body=maybe_transform(body, content_update_params.ContentUpdateParams), - files=files, + body=maybe_transform({"metadata": metadata}, content_update_params.ContentUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -217,8 +199,7 @@ async def update( *, account_id: str, dispatch_namespace: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN, + metadata: WorkerMetadataParam, cf_worker_body_part: str | NotGiven = NOT_GIVEN, cf_worker_main_module_part: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -238,13 +219,6 @@ async def update( script_name: Name of the script, used in URLs and route configuration. - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be - present. This should be referenced either in the metadata as `main_module` - (esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART` - (esm) /`CF-WORKER-BODY-PART` (service worker) by part name. Source maps may also - be included using the `application/source-map` content type. - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. extra_headers: Send extra headers @@ -270,21 +244,13 @@ async def update( ), **(extra_headers or {}), } - body = deepcopy_minimal( - { - "any_part_name": any_part_name, - "metadata": metadata, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["", ""]]) # It should be noted that the actual Content-Type header that will be # sent to the server will contain a `boundary` parameter, e.g. # multipart/form-data; boundary=---abc-- extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return await self._put( f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/content", - body=await async_maybe_transform(body, content_update_params.ContentUpdateParams), - files=files, + body=await async_maybe_transform({"metadata": metadata}, content_update_params.ContentUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py index 1f29a5acbe9..054cb9de7be 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py @@ -2,8 +2,7 @@ from __future__ import annotations -from typing import List, Type, Optional, cast -from typing_extensions import overload +from typing import Type, Optional, cast import httpx @@ -47,13 +46,20 @@ SettingsResourceWithStreamingResponse, AsyncSettingsResourceWithStreamingResponse, ) -from ......_types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileTypes +from ......_types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven from ......_utils import ( - required_args, maybe_transform, async_maybe_transform, ) from ......_compat import cached_property +from .asset_upload import ( + AssetUploadResource, + AsyncAssetUploadResource, + AssetUploadResourceWithRawResponse, + AsyncAssetUploadResourceWithRawResponse, + AssetUploadResourceWithStreamingResponse, + AsyncAssetUploadResourceWithStreamingResponse, +) from ......_resource import SyncAPIResource, AsyncAPIResource from ......_response import ( to_raw_response_wrapper, @@ -71,6 +77,10 @@ class ScriptsResource(SyncAPIResource): + @cached_property + def asset_upload(self) -> AssetUploadResource: + return AssetUploadResource(self._client) + @cached_property def content(self) -> ContentResource: return ContentResource(self._client) @@ -110,15 +120,13 @@ def with_streaming_response(self) -> ScriptsResourceWithStreamingResponse: """ return ScriptsResourceWithStreamingResponse(self) - @overload def update( self, script_name: str, *, account_id: str, dispatch_namespace: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: script_update_params.Variant0Metadata | NotGiven = NOT_GIVEN, + metadata: script_update_params.Metadata, # 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, @@ -139,12 +147,6 @@ def update( script_name: Name of the script, used in URLs and route configuration. - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be present - and referenced in the metadata as `main_module` or `body_part` by part name. - Source maps may also be included using the `application/source-map` content - type. - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. extra_headers: Send extra headers @@ -155,66 +157,6 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @overload - def update( - self, - script_name: str, - *, - account_id: str, - dispatch_namespace: str, - message: 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, - ) -> Optional[ScriptUpdateResponse]: - """Upload a worker module to a Workers for Platforms namespace. - - You can find more - about the multipart metadata on our docs: - https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/. - - Args: - account_id: Identifier - - dispatch_namespace: Name of the Workers for Platforms dispatch namespace. - - script_name: Name of the script, used in URLs and route configuration. - - message: Rollback message to be associated with this deployment. Only parsed when query - param `"rollback_to"` is present. - - 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 - """ - ... - - @required_args(["account_id", "dispatch_namespace"]) - def update( - self, - script_name: str, - *, - account_id: str, - dispatch_namespace: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: script_update_params.Variant0Metadata | NotGiven = NOT_GIVEN, - message: 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, - ) -> Optional[ScriptUpdateResponse]: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not dispatch_namespace: @@ -223,14 +165,7 @@ def update( raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") return self._put( f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}", - body=maybe_transform( - { - "any_part_name": any_part_name, - "metadata": metadata, - "message": message, - }, - script_update_params.ScriptUpdateParams, - ), + body=maybe_transform({"metadata": metadata}, script_update_params.ScriptUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -349,6 +284,10 @@ def get( class AsyncScriptsResource(AsyncAPIResource): + @cached_property + def asset_upload(self) -> AsyncAssetUploadResource: + return AsyncAssetUploadResource(self._client) + @cached_property def content(self) -> AsyncContentResource: return AsyncContentResource(self._client) @@ -388,15 +327,13 @@ def with_streaming_response(self) -> AsyncScriptsResourceWithStreamingResponse: """ return AsyncScriptsResourceWithStreamingResponse(self) - @overload async def update( self, script_name: str, *, account_id: str, dispatch_namespace: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: script_update_params.Variant0Metadata | NotGiven = NOT_GIVEN, + metadata: script_update_params.Metadata, # 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, @@ -417,12 +354,6 @@ async def update( script_name: Name of the script, used in URLs and route configuration. - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be present - and referenced in the metadata as `main_module` or `body_part` by part name. - Source maps may also be included using the `application/source-map` content - type. - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. extra_headers: Send extra headers @@ -433,66 +364,6 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @overload - async def update( - self, - script_name: str, - *, - account_id: str, - dispatch_namespace: str, - message: 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, - ) -> Optional[ScriptUpdateResponse]: - """Upload a worker module to a Workers for Platforms namespace. - - You can find more - about the multipart metadata on our docs: - https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/. - - Args: - account_id: Identifier - - dispatch_namespace: Name of the Workers for Platforms dispatch namespace. - - script_name: Name of the script, used in URLs and route configuration. - - message: Rollback message to be associated with this deployment. Only parsed when query - param `"rollback_to"` is present. - - 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 - """ - ... - - @required_args(["account_id", "dispatch_namespace"]) - async def update( - self, - script_name: str, - *, - account_id: str, - dispatch_namespace: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: script_update_params.Variant0Metadata | NotGiven = NOT_GIVEN, - message: 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, - ) -> Optional[ScriptUpdateResponse]: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not dispatch_namespace: @@ -501,14 +372,7 @@ async def update( raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") return await self._put( f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}", - body=await async_maybe_transform( - { - "any_part_name": any_part_name, - "metadata": metadata, - "message": message, - }, - script_update_params.ScriptUpdateParams, - ), + body=await async_maybe_transform({"metadata": metadata}, script_update_params.ScriptUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -640,6 +504,10 @@ def __init__(self, scripts: ScriptsResource) -> None: scripts.get, ) + @cached_property + def asset_upload(self) -> AssetUploadResourceWithRawResponse: + return AssetUploadResourceWithRawResponse(self._scripts.asset_upload) + @cached_property def content(self) -> ContentResourceWithRawResponse: return ContentResourceWithRawResponse(self._scripts.content) @@ -675,6 +543,10 @@ def __init__(self, scripts: AsyncScriptsResource) -> None: scripts.get, ) + @cached_property + def asset_upload(self) -> AsyncAssetUploadResourceWithRawResponse: + return AsyncAssetUploadResourceWithRawResponse(self._scripts.asset_upload) + @cached_property def content(self) -> AsyncContentResourceWithRawResponse: return AsyncContentResourceWithRawResponse(self._scripts.content) @@ -710,6 +582,10 @@ def __init__(self, scripts: ScriptsResource) -> None: scripts.get, ) + @cached_property + def asset_upload(self) -> AssetUploadResourceWithStreamingResponse: + return AssetUploadResourceWithStreamingResponse(self._scripts.asset_upload) + @cached_property def content(self) -> ContentResourceWithStreamingResponse: return ContentResourceWithStreamingResponse(self._scripts.content) @@ -745,6 +621,10 @@ def __init__(self, scripts: AsyncScriptsResource) -> None: scripts.get, ) + @cached_property + def asset_upload(self) -> AsyncAssetUploadResourceWithStreamingResponse: + return AsyncAssetUploadResourceWithStreamingResponse(self._scripts.asset_upload) + @cached_property def content(self) -> AsyncContentResourceWithStreamingResponse: return AsyncContentResourceWithStreamingResponse(self._scripts.content) diff --git a/src/cloudflare/resources/zero_trust/access/__init__.py b/src/cloudflare/resources/zero_trust/access/__init__.py index d368bdfbfc8..12bf11047ec 100644 --- a/src/cloudflare/resources/zero_trust/access/__init__.py +++ b/src/cloudflare/resources/zero_trust/access/__init__.py @@ -64,6 +64,14 @@ BookmarksResourceWithStreamingResponse, AsyncBookmarksResourceWithStreamingResponse, ) +from .gateway_ca import ( + GatewayCAResource, + AsyncGatewayCAResource, + GatewayCAResourceWithRawResponse, + AsyncGatewayCAResourceWithRawResponse, + GatewayCAResourceWithStreamingResponse, + AsyncGatewayCAResourceWithStreamingResponse, +) from .applications import ( ApplicationsResource, AsyncApplicationsResource, @@ -106,6 +114,12 @@ ) __all__ = [ + "GatewayCAResource", + "AsyncGatewayCAResource", + "GatewayCAResourceWithRawResponse", + "AsyncGatewayCAResourceWithRawResponse", + "GatewayCAResourceWithStreamingResponse", + "AsyncGatewayCAResourceWithStreamingResponse", "InfrastructureResource", "AsyncInfrastructureResource", "InfrastructureResourceWithRawResponse", diff --git a/src/cloudflare/resources/zero_trust/access/access.py b/src/cloudflare/resources/zero_trust/access/access.py index c76631f16f5..d6aef830815 100644 --- a/src/cloudflare/resources/zero_trust/access/access.py +++ b/src/cloudflare/resources/zero_trust/access/access.py @@ -51,6 +51,14 @@ AsyncLogsResourceWithStreamingResponse, ) from ...._compat import cached_property +from .gateway_ca import ( + GatewayCAResource, + AsyncGatewayCAResource, + GatewayCAResourceWithRawResponse, + AsyncGatewayCAResourceWithRawResponse, + GatewayCAResourceWithStreamingResponse, + AsyncGatewayCAResourceWithStreamingResponse, +) from .users.users import ( UsersResource, AsyncUsersResource, @@ -105,6 +113,10 @@ class AccessResource(SyncAPIResource): + @cached_property + def gateway_ca(self) -> GatewayCAResource: + return GatewayCAResource(self._client) + @cached_property def infrastructure(self) -> InfrastructureResource: return InfrastructureResource(self._client) @@ -174,6 +186,10 @@ def with_streaming_response(self) -> AccessResourceWithStreamingResponse: class AsyncAccessResource(AsyncAPIResource): + @cached_property + def gateway_ca(self) -> AsyncGatewayCAResource: + return AsyncGatewayCAResource(self._client) + @cached_property def infrastructure(self) -> AsyncInfrastructureResource: return AsyncInfrastructureResource(self._client) @@ -246,6 +262,10 @@ class AccessResourceWithRawResponse: def __init__(self, access: AccessResource) -> None: self._access = access + @cached_property + def gateway_ca(self) -> GatewayCAResourceWithRawResponse: + return GatewayCAResourceWithRawResponse(self._access.gateway_ca) + @cached_property def infrastructure(self) -> InfrastructureResourceWithRawResponse: return InfrastructureResourceWithRawResponse(self._access.infrastructure) @@ -299,6 +319,10 @@ class AsyncAccessResourceWithRawResponse: def __init__(self, access: AsyncAccessResource) -> None: self._access = access + @cached_property + def gateway_ca(self) -> AsyncGatewayCAResourceWithRawResponse: + return AsyncGatewayCAResourceWithRawResponse(self._access.gateway_ca) + @cached_property def infrastructure(self) -> AsyncInfrastructureResourceWithRawResponse: return AsyncInfrastructureResourceWithRawResponse(self._access.infrastructure) @@ -352,6 +376,10 @@ class AccessResourceWithStreamingResponse: def __init__(self, access: AccessResource) -> None: self._access = access + @cached_property + def gateway_ca(self) -> GatewayCAResourceWithStreamingResponse: + return GatewayCAResourceWithStreamingResponse(self._access.gateway_ca) + @cached_property def infrastructure(self) -> InfrastructureResourceWithStreamingResponse: return InfrastructureResourceWithStreamingResponse(self._access.infrastructure) @@ -405,6 +433,10 @@ class AsyncAccessResourceWithStreamingResponse: def __init__(self, access: AsyncAccessResource) -> None: self._access = access + @cached_property + def gateway_ca(self) -> AsyncGatewayCAResourceWithStreamingResponse: + return AsyncGatewayCAResourceWithStreamingResponse(self._access.gateway_ca) + @cached_property def infrastructure(self) -> AsyncInfrastructureResourceWithStreamingResponse: return AsyncInfrastructureResourceWithStreamingResponse(self._access.infrastructure) diff --git a/src/cloudflare/resources/zero_trust/access/gateway_ca.py b/src/cloudflare/resources/zero_trust/access/gateway_ca.py new file mode 100644 index 00000000000..d349400078f --- /dev/null +++ b/src/cloudflare/resources/zero_trust/access/gateway_ca.py @@ -0,0 +1,365 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Type, Optional, cast + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage +from ...._base_client import AsyncPaginator, make_request_options +from ....types.zero_trust.access.gateway_ca_list_response import GatewayCAListResponse +from ....types.zero_trust.access.gateway_ca_create_response import GatewayCACreateResponse +from ....types.zero_trust.access.gateway_ca_delete_response import GatewayCADeleteResponse + +__all__ = ["GatewayCAResource", "AsyncGatewayCAResource"] + + +class GatewayCAResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> GatewayCAResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return GatewayCAResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> GatewayCAResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return GatewayCAResourceWithStreamingResponse(self) + + def create( + 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, + ) -> Optional[GatewayCACreateResponse]: + """ + Adds a new SSH Certificate Authority (CA). + + 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._post( + f"/accounts/{account_id}/access/gateway_ca", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[GatewayCACreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[GatewayCACreateResponse]], ResultWrapper[GatewayCACreateResponse]), + ) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncSinglePage[GatewayCAListResponse]: + """ + Lists SSH Certificate Authorities (CA). + + 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_api_list( + f"/accounts/{account_id}/access/gateway_ca", + page=SyncSinglePage[GatewayCAListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=GatewayCAListResponse, + ) + + def delete( + self, + certificate_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[GatewayCADeleteResponse]: + """ + Deletes an SSH Certificate Authority. + + Args: + account_id: Identifier + + certificate_id: UUID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not certificate_id: + raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!r}") + return self._delete( + f"/accounts/{account_id}/access/gateway_ca/{certificate_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[GatewayCADeleteResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[GatewayCADeleteResponse]], ResultWrapper[GatewayCADeleteResponse]), + ) + + +class AsyncGatewayCAResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncGatewayCAResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncGatewayCAResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncGatewayCAResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncGatewayCAResourceWithStreamingResponse(self) + + async def create( + 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, + ) -> Optional[GatewayCACreateResponse]: + """ + Adds a new SSH Certificate Authority (CA). + + 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._post( + f"/accounts/{account_id}/access/gateway_ca", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[GatewayCACreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[GatewayCACreateResponse]], ResultWrapper[GatewayCACreateResponse]), + ) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[GatewayCAListResponse, AsyncSinglePage[GatewayCAListResponse]]: + """ + Lists SSH Certificate Authorities (CA). + + 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_api_list( + f"/accounts/{account_id}/access/gateway_ca", + page=AsyncSinglePage[GatewayCAListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=GatewayCAListResponse, + ) + + async def delete( + self, + certificate_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[GatewayCADeleteResponse]: + """ + Deletes an SSH Certificate Authority. + + Args: + account_id: Identifier + + certificate_id: UUID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not certificate_id: + raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!r}") + return await self._delete( + f"/accounts/{account_id}/access/gateway_ca/{certificate_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[GatewayCADeleteResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[GatewayCADeleteResponse]], ResultWrapper[GatewayCADeleteResponse]), + ) + + +class GatewayCAResourceWithRawResponse: + def __init__(self, gateway_ca: GatewayCAResource) -> None: + self._gateway_ca = gateway_ca + + self.create = to_raw_response_wrapper( + gateway_ca.create, + ) + self.list = to_raw_response_wrapper( + gateway_ca.list, + ) + self.delete = to_raw_response_wrapper( + gateway_ca.delete, + ) + + +class AsyncGatewayCAResourceWithRawResponse: + def __init__(self, gateway_ca: AsyncGatewayCAResource) -> None: + self._gateway_ca = gateway_ca + + self.create = async_to_raw_response_wrapper( + gateway_ca.create, + ) + self.list = async_to_raw_response_wrapper( + gateway_ca.list, + ) + self.delete = async_to_raw_response_wrapper( + gateway_ca.delete, + ) + + +class GatewayCAResourceWithStreamingResponse: + def __init__(self, gateway_ca: GatewayCAResource) -> None: + self._gateway_ca = gateway_ca + + self.create = to_streamed_response_wrapper( + gateway_ca.create, + ) + self.list = to_streamed_response_wrapper( + gateway_ca.list, + ) + self.delete = to_streamed_response_wrapper( + gateway_ca.delete, + ) + + +class AsyncGatewayCAResourceWithStreamingResponse: + def __init__(self, gateway_ca: AsyncGatewayCAResource) -> None: + self._gateway_ca = gateway_ca + + self.create = async_to_streamed_response_wrapper( + gateway_ca.create, + ) + self.list = async_to_streamed_response_wrapper( + gateway_ca.list, + ) + self.delete = async_to_streamed_response_wrapper( + gateway_ca.delete, + ) diff --git a/src/cloudflare/resources/zero_trust/access/infrastructure/targets.py b/src/cloudflare/resources/zero_trust/access/infrastructure/targets.py index 364b09d482d..ff0a4df5312 100644 --- a/src/cloudflare/resources/zero_trust/access/infrastructure/targets.py +++ b/src/cloudflare/resources/zero_trust/access/infrastructure/targets.py @@ -2,8 +2,9 @@ from __future__ import annotations -from typing import Type, Union, Iterable, Optional, cast +from typing import List, Type, Union, Iterable, Optional, cast from datetime import datetime +from typing_extensions import Literal import httpx @@ -176,11 +177,16 @@ def list( *, account_id: str, created_after: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + created_before: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, hostname: Optional[str] | NotGiven = NOT_GIVEN, hostname_contains: Optional[str] | NotGiven = NOT_GIVEN, ip_v4: Optional[str] | NotGiven = NOT_GIVEN, ip_v6: Optional[str] | NotGiven = NOT_GIVEN, + ips: List[str] | NotGiven = NOT_GIVEN, modified_after: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + modified_before: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + order: Literal["hostname", "created_at"] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, per_page: int | NotGiven = NOT_GIVEN, virtual_network_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -191,13 +197,20 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncV4PagePaginationArray[TargetListResponse]: - """ - List all targets + """Lists and sorts an account’s targets. + + Filters are optional and are ORed + together. However, when a timestamp is specified with both its before and after + counterparts, the timestamp filters are ANDed. Args: account_id: Account identifier - created_after: Date and time at which the target was created + created_after: Date and time at which the target was created after (inclusive) + + created_before: Date and time at which the target was created before (inclusive) + + direction: The sorting direction. hostname: Hostname of a target @@ -207,7 +220,14 @@ def list( ip_v6: IPv6 address of the target - modified_after: Date and time at which the target was modified + ips: Filters for targets that have any of the following IP addresses. Specify `ips` + multiple times in query parameter to build list of candidates. + + modified_after: Date and time at which the target was modified after (inclusive) + + modified_before: Date and time at which the target was modified before (inclusive) + + order: The field to sort by. page: Current page in the response @@ -236,11 +256,16 @@ def list( query=maybe_transform( { "created_after": created_after, + "created_before": created_before, + "direction": direction, "hostname": hostname, "hostname_contains": hostname_contains, "ip_v4": ip_v4, "ip_v6": ip_v6, + "ips": ips, "modified_after": modified_after, + "modified_before": modified_before, + "order": order, "page": page, "per_page": per_page, "virtual_network_id": virtual_network_id, @@ -548,11 +573,16 @@ def list( *, account_id: str, created_after: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + created_before: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, hostname: Optional[str] | NotGiven = NOT_GIVEN, hostname_contains: Optional[str] | NotGiven = NOT_GIVEN, ip_v4: Optional[str] | NotGiven = NOT_GIVEN, ip_v6: Optional[str] | NotGiven = NOT_GIVEN, + ips: List[str] | NotGiven = NOT_GIVEN, modified_after: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + modified_before: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + order: Literal["hostname", "created_at"] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, per_page: int | NotGiven = NOT_GIVEN, virtual_network_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -563,13 +593,20 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[TargetListResponse, AsyncV4PagePaginationArray[TargetListResponse]]: - """ - List all targets + """Lists and sorts an account’s targets. + + Filters are optional and are ORed + together. However, when a timestamp is specified with both its before and after + counterparts, the timestamp filters are ANDed. Args: account_id: Account identifier - created_after: Date and time at which the target was created + created_after: Date and time at which the target was created after (inclusive) + + created_before: Date and time at which the target was created before (inclusive) + + direction: The sorting direction. hostname: Hostname of a target @@ -579,7 +616,14 @@ def list( ip_v6: IPv6 address of the target - modified_after: Date and time at which the target was modified + ips: Filters for targets that have any of the following IP addresses. Specify `ips` + multiple times in query parameter to build list of candidates. + + modified_after: Date and time at which the target was modified after (inclusive) + + modified_before: Date and time at which the target was modified before (inclusive) + + order: The field to sort by. page: Current page in the response @@ -608,11 +652,16 @@ def list( query=maybe_transform( { "created_after": created_after, + "created_before": created_before, + "direction": direction, "hostname": hostname, "hostname_contains": hostname_contains, "ip_v4": ip_v4, "ip_v6": ip_v6, + "ips": ips, "modified_after": modified_after, + "modified_before": modified_before, + "order": order, "page": page, "per_page": per_page, "virtual_network_id": virtual_network_id, diff --git a/src/cloudflare/resources/zero_trust/devices/devices.py b/src/cloudflare/resources/zero_trust/devices/devices.py index 3b946277c22..cdb59f224e5 100644 --- a/src/cloudflare/resources/zero_trust/devices/devices.py +++ b/src/cloudflare/resources/zero_trust/devices/devices.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Type, Optional, cast import httpx @@ -197,7 +197,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DeviceGetResponse: + ) -> Optional[DeviceGetResponse]: """ Fetches details for a single device. @@ -216,21 +216,16 @@ def get( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not device_id: raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - return cast( - DeviceGetResponse, - self._get( - f"/accounts/{account_id}/devices/{device_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[DeviceGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[DeviceGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/accounts/{account_id}/devices/{device_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[DeviceGetResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[DeviceGetResponse]], ResultWrapper[DeviceGetResponse]), ) @@ -335,7 +330,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DeviceGetResponse: + ) -> Optional[DeviceGetResponse]: """ Fetches details for a single device. @@ -354,21 +349,16 @@ async def get( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not device_id: raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - return cast( - DeviceGetResponse, - await self._get( - f"/accounts/{account_id}/devices/{device_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[DeviceGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[DeviceGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/accounts/{account_id}/devices/{device_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[DeviceGetResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[DeviceGetResponse]], ResultWrapper[DeviceGetResponse]), ) diff --git a/src/cloudflare/resources/zero_trust/devices/fleet_status.py b/src/cloudflare/resources/zero_trust/devices/fleet_status.py index 871b776677f..57b2c298c03 100644 --- a/src/cloudflare/resources/zero_trust/devices/fleet_status.py +++ b/src/cloudflare/resources/zero_trust/devices/fleet_status.py @@ -85,7 +85,7 @@ def get( if not device_id: raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") return self._get( - f"/accounts/{account_id}/devices/{device_id}/fleet-status/live", + f"/accounts/{account_id}/dex/devices/{device_id}/fleet-status/live", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -165,7 +165,7 @@ async def get( if not device_id: raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") return await self._get( - f"/accounts/{account_id}/devices/{device_id}/fleet-status/live", + f"/accounts/{account_id}/dex/devices/{device_id}/fleet-status/live", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/zero_trust/devices/policies/default/certificates.py b/src/cloudflare/resources/zero_trust/devices/policies/default/certificates.py index 1996ac06b92..d14e2eaa953 100644 --- a/src/cloudflare/resources/zero_trust/devices/policies/default/certificates.py +++ b/src/cloudflare/resources/zero_trust/devices/policies/default/certificates.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Any, Optional, cast import httpx @@ -59,7 +59,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CertificateEditResponse: + ) -> Optional[CertificateEditResponse]: """ Enable Zero Trust Clients to provision a certificate, containing a x509 subject, and referenced by Access device posture policies when the client visits MTLS @@ -80,7 +80,7 @@ def edit( if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return cast( - CertificateEditResponse, + Optional[CertificateEditResponse], self._patch( f"/zones/{zone_id}/devices/policy/certificates", body=maybe_transform({"enabled": enabled}, certificate_edit_params.CertificateEditParams), @@ -89,7 +89,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CertificateEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CertificateEditResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CertificateEditResponse] @@ -107,7 +107,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CertificateGetResponse: + ) -> Optional[CertificateGetResponse]: """ Fetches device certificate provisioning @@ -123,7 +123,7 @@ def get( if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return cast( - CertificateGetResponse, + Optional[CertificateGetResponse], self._get( f"/zones/{zone_id}/devices/policy/certificates", options=make_request_options( @@ -131,7 +131,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CertificateGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CertificateGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CertificateGetResponse] @@ -171,7 +171,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CertificateEditResponse: + ) -> Optional[CertificateEditResponse]: """ Enable Zero Trust Clients to provision a certificate, containing a x509 subject, and referenced by Access device posture policies when the client visits MTLS @@ -192,7 +192,7 @@ async def edit( if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return cast( - CertificateEditResponse, + Optional[CertificateEditResponse], await self._patch( f"/zones/{zone_id}/devices/policy/certificates", body=await async_maybe_transform({"enabled": enabled}, certificate_edit_params.CertificateEditParams), @@ -201,7 +201,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CertificateEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CertificateEditResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CertificateEditResponse] @@ -219,7 +219,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CertificateGetResponse: + ) -> Optional[CertificateGetResponse]: """ Fetches device certificate provisioning @@ -235,7 +235,7 @@ async def get( if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return cast( - CertificateGetResponse, + Optional[CertificateGetResponse], await self._get( f"/zones/{zone_id}/devices/policy/certificates", options=make_request_options( @@ -243,7 +243,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CertificateGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CertificateGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CertificateGetResponse] diff --git a/src/cloudflare/resources/zero_trust/devices/posture/integrations.py b/src/cloudflare/resources/zero_trust/devices/posture/integrations.py index 0074d8055da..c02ac6559f6 100644 --- a/src/cloudflare/resources/zero_trust/devices/posture/integrations.py +++ b/src/cloudflare/resources/zero_trust/devices/posture/integrations.py @@ -156,7 +156,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IntegrationDeleteResponse: + ) -> Optional[IntegrationDeleteResponse]: """ Delete a configured device posture integration. @@ -176,7 +176,7 @@ def delete( if not integration_id: raise ValueError(f"Expected a non-empty value for `integration_id` but received {integration_id!r}") return cast( - IntegrationDeleteResponse, + Optional[IntegrationDeleteResponse], self._delete( f"/accounts/{account_id}/devices/posture/integration/{integration_id}", options=make_request_options( @@ -184,7 +184,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[IntegrationDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[IntegrationDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[IntegrationDeleteResponse] @@ -428,7 +428,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IntegrationDeleteResponse: + ) -> Optional[IntegrationDeleteResponse]: """ Delete a configured device posture integration. @@ -448,7 +448,7 @@ async def delete( if not integration_id: raise ValueError(f"Expected a non-empty value for `integration_id` but received {integration_id!r}") return cast( - IntegrationDeleteResponse, + Optional[IntegrationDeleteResponse], await self._delete( f"/accounts/{account_id}/devices/posture/integration/{integration_id}", options=make_request_options( @@ -456,7 +456,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[IntegrationDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[IntegrationDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[IntegrationDeleteResponse] diff --git a/src/cloudflare/resources/zero_trust/devices/revoke.py b/src/cloudflare/resources/zero_trust/devices/revoke.py index d14f3536764..3057bf6c62d 100644 --- a/src/cloudflare/resources/zero_trust/devices/revoke.py +++ b/src/cloudflare/resources/zero_trust/devices/revoke.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, List, cast +from typing import Any, List, Optional, cast import httpx @@ -57,7 +57,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RevokeCreateResponse: + ) -> Optional[RevokeCreateResponse]: """ Revokes a list of devices. @@ -75,7 +75,7 @@ def create( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - RevokeCreateResponse, + Optional[RevokeCreateResponse], self._post( f"/accounts/{account_id}/devices/revoke", body=maybe_transform(body, List[str]), @@ -84,7 +84,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RevokeCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[RevokeCreateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RevokeCreateResponse] @@ -124,7 +124,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RevokeCreateResponse: + ) -> Optional[RevokeCreateResponse]: """ Revokes a list of devices. @@ -142,7 +142,7 @@ async def create( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - RevokeCreateResponse, + Optional[RevokeCreateResponse], await self._post( f"/accounts/{account_id}/devices/revoke", body=await async_maybe_transform(body, List[str]), @@ -151,7 +151,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RevokeCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[RevokeCreateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RevokeCreateResponse] diff --git a/src/cloudflare/resources/zero_trust/devices/unrevoke.py b/src/cloudflare/resources/zero_trust/devices/unrevoke.py index 3c4489edec1..b99f36a0037 100644 --- a/src/cloudflare/resources/zero_trust/devices/unrevoke.py +++ b/src/cloudflare/resources/zero_trust/devices/unrevoke.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, List, cast +from typing import Any, List, Optional, cast import httpx @@ -57,7 +57,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UnrevokeCreateResponse: + ) -> Optional[UnrevokeCreateResponse]: """ Unrevokes a list of devices. @@ -75,7 +75,7 @@ def create( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - UnrevokeCreateResponse, + Optional[UnrevokeCreateResponse], self._post( f"/accounts/{account_id}/devices/unrevoke", body=maybe_transform(body, List[str]), @@ -84,7 +84,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[UnrevokeCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[UnrevokeCreateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[UnrevokeCreateResponse] @@ -124,7 +124,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UnrevokeCreateResponse: + ) -> Optional[UnrevokeCreateResponse]: """ Unrevokes a list of devices. @@ -142,7 +142,7 @@ async def create( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - UnrevokeCreateResponse, + Optional[UnrevokeCreateResponse], await self._post( f"/accounts/{account_id}/devices/unrevoke", body=await async_maybe_transform(body, List[str]), @@ -151,7 +151,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[UnrevokeCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[UnrevokeCreateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[UnrevokeCreateResponse] diff --git a/src/cloudflare/resources/zero_trust/dex/commands/__init__.py b/src/cloudflare/resources/zero_trust/dex/commands/__init__.py index 4566edefe96..1cf551c58ba 100644 --- a/src/cloudflare/resources/zero_trust/dex/commands/__init__.py +++ b/src/cloudflare/resources/zero_trust/dex/commands/__init__.py @@ -8,6 +8,22 @@ QuotaResourceWithStreamingResponse, AsyncQuotaResourceWithStreamingResponse, ) +from .users import ( + UsersResource, + AsyncUsersResource, + UsersResourceWithRawResponse, + AsyncUsersResourceWithRawResponse, + UsersResourceWithStreamingResponse, + AsyncUsersResourceWithStreamingResponse, +) +from .devices import ( + DevicesResource, + AsyncDevicesResource, + DevicesResourceWithRawResponse, + AsyncDevicesResourceWithRawResponse, + DevicesResourceWithStreamingResponse, + AsyncDevicesResourceWithStreamingResponse, +) from .commands import ( CommandsResource, AsyncCommandsResource, @@ -26,6 +42,18 @@ ) __all__ = [ + "UsersResource", + "AsyncUsersResource", + "UsersResourceWithRawResponse", + "AsyncUsersResourceWithRawResponse", + "UsersResourceWithStreamingResponse", + "AsyncUsersResourceWithStreamingResponse", + "DevicesResource", + "AsyncDevicesResource", + "DevicesResourceWithRawResponse", + "AsyncDevicesResourceWithRawResponse", + "DevicesResourceWithStreamingResponse", + "AsyncDevicesResourceWithStreamingResponse", "DownloadsResource", "AsyncDownloadsResource", "DownloadsResourceWithRawResponse", diff --git a/src/cloudflare/resources/zero_trust/dex/commands/commands.py b/src/cloudflare/resources/zero_trust/dex/commands/commands.py index f59aadf5646..7f887f8e617 100644 --- a/src/cloudflare/resources/zero_trust/dex/commands/commands.py +++ b/src/cloudflare/resources/zero_trust/dex/commands/commands.py @@ -16,6 +16,22 @@ QuotaResourceWithStreamingResponse, AsyncQuotaResourceWithStreamingResponse, ) +from .users import ( + UsersResource, + AsyncUsersResource, + UsersResourceWithRawResponse, + AsyncUsersResourceWithRawResponse, + UsersResourceWithStreamingResponse, + AsyncUsersResourceWithStreamingResponse, +) +from .devices import ( + DevicesResource, + AsyncDevicesResource, + DevicesResourceWithRawResponse, + AsyncDevicesResourceWithRawResponse, + DevicesResourceWithStreamingResponse, + AsyncDevicesResourceWithStreamingResponse, +) from .downloads import ( DownloadsResource, AsyncDownloadsResource, @@ -48,6 +64,14 @@ class CommandsResource(SyncAPIResource): + @cached_property + def users(self) -> UsersResource: + return UsersResource(self._client) + + @cached_property + def devices(self) -> DevicesResource: + return DevicesResource(self._client) + @cached_property def downloads(self) -> DownloadsResource: return DownloadsResource(self._client) @@ -104,7 +128,7 @@ def create( 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}/commands", + f"/accounts/{account_id}/dex/commands", body=maybe_transform({"commands": commands}, command_create_params.CommandCreateParams), options=make_request_options( extra_headers=extra_headers, @@ -167,7 +191,7 @@ def list( 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}/commands", + f"/accounts/{account_id}/dex/commands", page=SyncV4PagePagination[Optional[CommandListResponse]], options=make_request_options( extra_headers=extra_headers, @@ -193,6 +217,14 @@ def list( class AsyncCommandsResource(AsyncAPIResource): + @cached_property + def users(self) -> AsyncUsersResource: + return AsyncUsersResource(self._client) + + @cached_property + def devices(self) -> AsyncDevicesResource: + return AsyncDevicesResource(self._client) + @cached_property def downloads(self) -> AsyncDownloadsResource: return AsyncDownloadsResource(self._client) @@ -249,7 +281,7 @@ async def create( 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}/commands", + f"/accounts/{account_id}/dex/commands", body=await async_maybe_transform({"commands": commands}, command_create_params.CommandCreateParams), options=make_request_options( extra_headers=extra_headers, @@ -312,7 +344,7 @@ def list( 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}/commands", + f"/accounts/{account_id}/dex/commands", page=AsyncV4PagePagination[Optional[CommandListResponse]], options=make_request_options( extra_headers=extra_headers, @@ -348,6 +380,14 @@ def __init__(self, commands: CommandsResource) -> None: commands.list, ) + @cached_property + def users(self) -> UsersResourceWithRawResponse: + return UsersResourceWithRawResponse(self._commands.users) + + @cached_property + def devices(self) -> DevicesResourceWithRawResponse: + return DevicesResourceWithRawResponse(self._commands.devices) + @cached_property def downloads(self) -> DownloadsResourceWithRawResponse: return DownloadsResourceWithRawResponse(self._commands.downloads) @@ -368,6 +408,14 @@ def __init__(self, commands: AsyncCommandsResource) -> None: commands.list, ) + @cached_property + def users(self) -> AsyncUsersResourceWithRawResponse: + return AsyncUsersResourceWithRawResponse(self._commands.users) + + @cached_property + def devices(self) -> AsyncDevicesResourceWithRawResponse: + return AsyncDevicesResourceWithRawResponse(self._commands.devices) + @cached_property def downloads(self) -> AsyncDownloadsResourceWithRawResponse: return AsyncDownloadsResourceWithRawResponse(self._commands.downloads) @@ -388,6 +436,14 @@ def __init__(self, commands: CommandsResource) -> None: commands.list, ) + @cached_property + def users(self) -> UsersResourceWithStreamingResponse: + return UsersResourceWithStreamingResponse(self._commands.users) + + @cached_property + def devices(self) -> DevicesResourceWithStreamingResponse: + return DevicesResourceWithStreamingResponse(self._commands.devices) + @cached_property def downloads(self) -> DownloadsResourceWithStreamingResponse: return DownloadsResourceWithStreamingResponse(self._commands.downloads) @@ -408,6 +464,14 @@ def __init__(self, commands: AsyncCommandsResource) -> None: commands.list, ) + @cached_property + def users(self) -> AsyncUsersResourceWithStreamingResponse: + return AsyncUsersResourceWithStreamingResponse(self._commands.users) + + @cached_property + def devices(self) -> AsyncDevicesResourceWithStreamingResponse: + return AsyncDevicesResourceWithStreamingResponse(self._commands.devices) + @cached_property def downloads(self) -> AsyncDownloadsResourceWithStreamingResponse: return AsyncDownloadsResourceWithStreamingResponse(self._commands.downloads) diff --git a/src/cloudflare/resources/zero_trust/dex/commands/devices.py b/src/cloudflare/resources/zero_trust/dex/commands/devices.py new file mode 100644 index 00000000000..4f3b3697c94 --- /dev/null +++ b/src/cloudflare/resources/zero_trust/dex/commands/devices.py @@ -0,0 +1,212 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional + +import httpx + +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 SyncV4PagePagination, AsyncV4PagePagination +from ....._base_client import AsyncPaginator, make_request_options +from .....types.zero_trust.dex.commands import device_list_params +from .....types.zero_trust.dex.commands.device_list_response import DeviceListResponse + +__all__ = ["DevicesResource", "AsyncDevicesResource"] + + +class DevicesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> DevicesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return DevicesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> DevicesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return DevicesResourceWithStreamingResponse(self) + + def list( + self, + *, + account_id: str, + page: float, + per_page: float, + search: 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[Optional[DeviceListResponse]]: + """ + List devices with WARP client support for remote captures which have been + connected in the last 1 hour. + + Args: + page: Page number of paginated results + + per_page: Number of items per page + + search: Filter devices by name or email + + 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}/dex/commands/devices", + page=SyncV4PagePagination[Optional[DeviceListResponse]], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "page": page, + "per_page": per_page, + "search": search, + }, + device_list_params.DeviceListParams, + ), + ), + model=DeviceListResponse, + ) + + +class AsyncDevicesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncDevicesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncDevicesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncDevicesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncDevicesResourceWithStreamingResponse(self) + + def list( + self, + *, + account_id: str, + page: float, + per_page: float, + search: 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[Optional[DeviceListResponse], AsyncV4PagePagination[Optional[DeviceListResponse]]]: + """ + List devices with WARP client support for remote captures which have been + connected in the last 1 hour. + + Args: + page: Page number of paginated results + + per_page: Number of items per page + + search: Filter devices by name or email + + 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}/dex/commands/devices", + page=AsyncV4PagePagination[Optional[DeviceListResponse]], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "page": page, + "per_page": per_page, + "search": search, + }, + device_list_params.DeviceListParams, + ), + ), + model=DeviceListResponse, + ) + + +class DevicesResourceWithRawResponse: + def __init__(self, devices: DevicesResource) -> None: + self._devices = devices + + self.list = to_raw_response_wrapper( + devices.list, + ) + + +class AsyncDevicesResourceWithRawResponse: + def __init__(self, devices: AsyncDevicesResource) -> None: + self._devices = devices + + self.list = async_to_raw_response_wrapper( + devices.list, + ) + + +class DevicesResourceWithStreamingResponse: + def __init__(self, devices: DevicesResource) -> None: + self._devices = devices + + self.list = to_streamed_response_wrapper( + devices.list, + ) + + +class AsyncDevicesResourceWithStreamingResponse: + def __init__(self, devices: AsyncDevicesResource) -> None: + self._devices = devices + + self.list = async_to_streamed_response_wrapper( + devices.list, + ) diff --git a/src/cloudflare/resources/zero_trust/dex/commands/downloads.py b/src/cloudflare/resources/zero_trust/dex/commands/downloads.py index 4baa6e25922..57b8e0320aa 100644 --- a/src/cloudflare/resources/zero_trust/dex/commands/downloads.py +++ b/src/cloudflare/resources/zero_trust/dex/commands/downloads.py @@ -78,7 +78,7 @@ def get( raise ValueError(f"Expected a non-empty value for `filename` but received {filename!r}") extra_headers = {"Accept": "application/zip", **(extra_headers or {})} return self._get( - f"/accounts/{account_id}/commands/{command_id}/downloads/{filename}", + f"/accounts/{account_id}/dex/commands/{command_id}/downloads/{filename}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -142,7 +142,7 @@ async def get( raise ValueError(f"Expected a non-empty value for `filename` but received {filename!r}") extra_headers = {"Accept": "application/zip", **(extra_headers or {})} return await self._get( - f"/accounts/{account_id}/commands/{command_id}/downloads/{filename}", + f"/accounts/{account_id}/dex/commands/{command_id}/downloads/{filename}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/cloudflare/resources/zero_trust/dex/commands/quota.py b/src/cloudflare/resources/zero_trust/dex/commands/quota.py index f16c78b78ce..8a0ba05b4b3 100644 --- a/src/cloudflare/resources/zero_trust/dex/commands/quota.py +++ b/src/cloudflare/resources/zero_trust/dex/commands/quota.py @@ -69,7 +69,7 @@ def get( 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}/commands/quota", + f"/accounts/{account_id}/dex/commands/quota", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -128,7 +128,7 @@ async def get( 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}/commands/quota", + f"/accounts/{account_id}/dex/commands/quota", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/zero_trust/dex/commands/users.py b/src/cloudflare/resources/zero_trust/dex/commands/users.py new file mode 100644 index 00000000000..7c9308df318 --- /dev/null +++ b/src/cloudflare/resources/zero_trust/dex/commands/users.py @@ -0,0 +1,189 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Type, Optional, cast + +import httpx + +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._utils import ( + maybe_transform, + async_maybe_transform, +) +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._wrappers import ResultWrapper +from ....._base_client import make_request_options +from .....types.zero_trust.dex.commands import user_list_params +from .....types.zero_trust.dex.commands.user_list_response import UserListResponse + +__all__ = ["UsersResource", "AsyncUsersResource"] + + +class UsersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> UsersResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return UsersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> UsersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return UsersResourceWithStreamingResponse(self) + + def list( + self, + *, + account_id: str, + search: 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, + ) -> Optional[UserListResponse]: + """ + List users emails associated with devices with WARP client support for remote + captures which have been connected in the last 1 hour. + + Args: + search: filter user emails by search + + 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}/dex/commands/users", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"search": search}, user_list_params.UserListParams), + post_parser=ResultWrapper[Optional[UserListResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[UserListResponse]], ResultWrapper[UserListResponse]), + ) + + +class AsyncUsersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncUsersResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncUsersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncUsersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncUsersResourceWithStreamingResponse(self) + + async def list( + self, + *, + account_id: str, + search: 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, + ) -> Optional[UserListResponse]: + """ + List users emails associated with devices with WARP client support for remote + captures which have been connected in the last 1 hour. + + Args: + search: filter user emails by search + + 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}/dex/commands/users", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"search": search}, user_list_params.UserListParams), + post_parser=ResultWrapper[Optional[UserListResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[UserListResponse]], ResultWrapper[UserListResponse]), + ) + + +class UsersResourceWithRawResponse: + def __init__(self, users: UsersResource) -> None: + self._users = users + + self.list = to_raw_response_wrapper( + users.list, + ) + + +class AsyncUsersResourceWithRawResponse: + def __init__(self, users: AsyncUsersResource) -> None: + self._users = users + + self.list = async_to_raw_response_wrapper( + users.list, + ) + + +class UsersResourceWithStreamingResponse: + def __init__(self, users: UsersResource) -> None: + self._users = users + + self.list = to_streamed_response_wrapper( + users.list, + ) + + +class AsyncUsersResourceWithStreamingResponse: + def __init__(self, users: AsyncUsersResource) -> None: + self._users = users + + self.list = async_to_streamed_response_wrapper( + users.list, + ) diff --git a/src/cloudflare/resources/zero_trust/dlp/__init__.py b/src/cloudflare/resources/zero_trust/dlp/__init__.py index b3185380cfb..03f7e960404 100644 --- a/src/cloudflare/resources/zero_trust/dlp/__init__.py +++ b/src/cloudflare/resources/zero_trust/dlp/__init__.py @@ -8,6 +8,14 @@ DLPResourceWithStreamingResponse, AsyncDLPResourceWithStreamingResponse, ) +from .email import ( + EmailResource, + AsyncEmailResource, + EmailResourceWithRawResponse, + AsyncEmailResourceWithRawResponse, + EmailResourceWithStreamingResponse, + AsyncEmailResourceWithStreamingResponse, +) from .limits import ( LimitsResource, AsyncLimitsResource, @@ -76,6 +84,12 @@ "AsyncPayloadLogsResourceWithRawResponse", "PayloadLogsResourceWithStreamingResponse", "AsyncPayloadLogsResourceWithStreamingResponse", + "EmailResource", + "AsyncEmailResource", + "EmailResourceWithRawResponse", + "AsyncEmailResourceWithRawResponse", + "EmailResourceWithStreamingResponse", + "AsyncEmailResourceWithStreamingResponse", "ProfilesResource", "AsyncProfilesResource", "ProfilesResourceWithRawResponse", diff --git a/src/cloudflare/resources/zero_trust/dlp/dlp.py b/src/cloudflare/resources/zero_trust/dlp/dlp.py index 742d20a6233..2a5da23c2db 100644 --- a/src/cloudflare/resources/zero_trust/dlp/dlp.py +++ b/src/cloudflare/resources/zero_trust/dlp/dlp.py @@ -27,6 +27,14 @@ AsyncPatternsResourceWithStreamingResponse, ) from ...._compat import cached_property +from .email.email import ( + EmailResource, + AsyncEmailResource, + EmailResourceWithRawResponse, + AsyncEmailResourceWithRawResponse, + EmailResourceWithStreamingResponse, + AsyncEmailResourceWithStreamingResponse, +) from ...._resource import SyncAPIResource, AsyncAPIResource from .payload_logs import ( PayloadLogsResource, @@ -69,6 +77,10 @@ def patterns(self) -> PatternsResource: def payload_logs(self) -> PayloadLogsResource: return PayloadLogsResource(self._client) + @cached_property + def email(self) -> EmailResource: + return EmailResource(self._client) + @cached_property def profiles(self) -> ProfilesResource: return ProfilesResource(self._client) @@ -114,6 +126,10 @@ def patterns(self) -> AsyncPatternsResource: def payload_logs(self) -> AsyncPayloadLogsResource: return AsyncPayloadLogsResource(self._client) + @cached_property + def email(self) -> AsyncEmailResource: + return AsyncEmailResource(self._client) + @cached_property def profiles(self) -> AsyncProfilesResource: return AsyncProfilesResource(self._client) @@ -162,6 +178,10 @@ def patterns(self) -> PatternsResourceWithRawResponse: def payload_logs(self) -> PayloadLogsResourceWithRawResponse: return PayloadLogsResourceWithRawResponse(self._dlp.payload_logs) + @cached_property + def email(self) -> EmailResourceWithRawResponse: + return EmailResourceWithRawResponse(self._dlp.email) + @cached_property def profiles(self) -> ProfilesResourceWithRawResponse: return ProfilesResourceWithRawResponse(self._dlp.profiles) @@ -191,6 +211,10 @@ def patterns(self) -> AsyncPatternsResourceWithRawResponse: def payload_logs(self) -> AsyncPayloadLogsResourceWithRawResponse: return AsyncPayloadLogsResourceWithRawResponse(self._dlp.payload_logs) + @cached_property + def email(self) -> AsyncEmailResourceWithRawResponse: + return AsyncEmailResourceWithRawResponse(self._dlp.email) + @cached_property def profiles(self) -> AsyncProfilesResourceWithRawResponse: return AsyncProfilesResourceWithRawResponse(self._dlp.profiles) @@ -220,6 +244,10 @@ def patterns(self) -> PatternsResourceWithStreamingResponse: def payload_logs(self) -> PayloadLogsResourceWithStreamingResponse: return PayloadLogsResourceWithStreamingResponse(self._dlp.payload_logs) + @cached_property + def email(self) -> EmailResourceWithStreamingResponse: + return EmailResourceWithStreamingResponse(self._dlp.email) + @cached_property def profiles(self) -> ProfilesResourceWithStreamingResponse: return ProfilesResourceWithStreamingResponse(self._dlp.profiles) @@ -249,6 +277,10 @@ def patterns(self) -> AsyncPatternsResourceWithStreamingResponse: def payload_logs(self) -> AsyncPayloadLogsResourceWithStreamingResponse: return AsyncPayloadLogsResourceWithStreamingResponse(self._dlp.payload_logs) + @cached_property + def email(self) -> AsyncEmailResourceWithStreamingResponse: + return AsyncEmailResourceWithStreamingResponse(self._dlp.email) + @cached_property def profiles(self) -> AsyncProfilesResourceWithStreamingResponse: return AsyncProfilesResourceWithStreamingResponse(self._dlp.profiles) diff --git a/src/cloudflare/resources/zero_trust/dlp/email/__init__.py b/src/cloudflare/resources/zero_trust/dlp/email/__init__.py new file mode 100644 index 00000000000..bed0373f820 --- /dev/null +++ b/src/cloudflare/resources/zero_trust/dlp/email/__init__.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .email import ( + EmailResource, + AsyncEmailResource, + EmailResourceWithRawResponse, + AsyncEmailResourceWithRawResponse, + EmailResourceWithStreamingResponse, + AsyncEmailResourceWithStreamingResponse, +) +from .rules import ( + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, +) +from .account_mapping import ( + AccountMappingResource, + AsyncAccountMappingResource, + AccountMappingResourceWithRawResponse, + AsyncAccountMappingResourceWithRawResponse, + AccountMappingResourceWithStreamingResponse, + AsyncAccountMappingResourceWithStreamingResponse, +) + +__all__ = [ + "AccountMappingResource", + "AsyncAccountMappingResource", + "AccountMappingResourceWithRawResponse", + "AsyncAccountMappingResourceWithRawResponse", + "AccountMappingResourceWithStreamingResponse", + "AsyncAccountMappingResourceWithStreamingResponse", + "RulesResource", + "AsyncRulesResource", + "RulesResourceWithRawResponse", + "AsyncRulesResourceWithRawResponse", + "RulesResourceWithStreamingResponse", + "AsyncRulesResourceWithStreamingResponse", + "EmailResource", + "AsyncEmailResource", + "EmailResourceWithRawResponse", + "AsyncEmailResourceWithRawResponse", + "EmailResourceWithStreamingResponse", + "AsyncEmailResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/addressing/prefixes/bgp/statuses.py b/src/cloudflare/resources/zero_trust/dlp/email/account_mapping.py similarity index 59% rename from src/cloudflare/resources/addressing/prefixes/bgp/statuses.py rename to src/cloudflare/resources/zero_trust/dlp/email/account_mapping.py index adab1b6a231..d9c04a979d4 100644 --- a/src/cloudflare/resources/addressing/prefixes/bgp/statuses.py +++ b/src/cloudflare/resources/zero_trust/dlp/email/account_mapping.py @@ -21,56 +21,49 @@ ) from ....._wrappers import ResultWrapper from ....._base_client import make_request_options -from .....types.addressing.prefixes.bgp import status_edit_params -from .....types.addressing.prefixes.bgp.status_get_response import StatusGetResponse -from .....types.addressing.prefixes.bgp.status_edit_response import StatusEditResponse +from .....types.zero_trust.dlp.email import account_mapping_create_params +from .....types.zero_trust.dlp.email.account_mapping_get_response import AccountMappingGetResponse +from .....types.zero_trust.dlp.email.account_mapping_create_response import AccountMappingCreateResponse -__all__ = ["StatusesResource", "AsyncStatusesResource"] +__all__ = ["AccountMappingResource", "AsyncAccountMappingResource"] -class StatusesResource(SyncAPIResource): +class AccountMappingResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> StatusesResourceWithRawResponse: + def with_raw_response(self) -> AccountMappingResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers """ - return StatusesResourceWithRawResponse(self) + return AccountMappingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> StatusesResourceWithStreamingResponse: + def with_streaming_response(self) -> AccountMappingResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response """ - return StatusesResourceWithStreamingResponse(self) + return AccountMappingResourceWithStreamingResponse(self) - def edit( + def create( self, - prefix_id: str, *, account_id: str, - advertised: bool, + auth_requirements: account_mapping_create_params.AuthRequirements, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[StatusEditResponse]: + ) -> Optional[AccountMappingCreateResponse]: """ - Advertise or withdraw BGP route for a prefix. + Create mapping Args: - account_id: Identifier - - prefix_id: Identifier - - advertised: Enablement of prefix advertisement to the Internet. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -81,24 +74,23 @@ def edit( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not prefix_id: - raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") - return self._patch( - f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/status", - body=maybe_transform({"advertised": advertised}, status_edit_params.StatusEditParams), + return self._post( + f"/accounts/{account_id}/dlp/email/account_mapping", + body=maybe_transform( + {"auth_requirements": auth_requirements}, account_mapping_create_params.AccountMappingCreateParams + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[StatusEditResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[AccountMappingCreateResponse]]._unwrapper, ), - cast_to=cast(Type[Optional[StatusEditResponse]], ResultWrapper[StatusEditResponse]), + cast_to=cast(Type[Optional[AccountMappingCreateResponse]], ResultWrapper[AccountMappingCreateResponse]), ) def get( self, - prefix_id: str, *, account_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -107,15 +99,11 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[StatusGetResponse]: + ) -> Optional[AccountMappingGetResponse]: """ - List the current advertisement state for a prefix. + Get mapping Args: - account_id: Identifier - - prefix_id: Identifier - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -126,64 +114,55 @@ def get( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not prefix_id: - raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") return self._get( - f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/status", + f"/accounts/{account_id}/dlp/email/account_mapping", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[StatusGetResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[AccountMappingGetResponse]]._unwrapper, ), - cast_to=cast(Type[Optional[StatusGetResponse]], ResultWrapper[StatusGetResponse]), + cast_to=cast(Type[Optional[AccountMappingGetResponse]], ResultWrapper[AccountMappingGetResponse]), ) -class AsyncStatusesResource(AsyncAPIResource): +class AsyncAccountMappingResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncStatusesResourceWithRawResponse: + def with_raw_response(self) -> AsyncAccountMappingResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers """ - return AsyncStatusesResourceWithRawResponse(self) + return AsyncAccountMappingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncStatusesResourceWithStreamingResponse: + def with_streaming_response(self) -> AsyncAccountMappingResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response """ - return AsyncStatusesResourceWithStreamingResponse(self) + return AsyncAccountMappingResourceWithStreamingResponse(self) - async def edit( + async def create( self, - prefix_id: str, *, account_id: str, - advertised: bool, + auth_requirements: account_mapping_create_params.AuthRequirements, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[StatusEditResponse]: + ) -> Optional[AccountMappingCreateResponse]: """ - Advertise or withdraw BGP route for a prefix. + Create mapping Args: - account_id: Identifier - - prefix_id: Identifier - - advertised: Enablement of prefix advertisement to the Internet. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -194,24 +173,23 @@ async def edit( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not prefix_id: - raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") - return await self._patch( - f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/status", - body=await async_maybe_transform({"advertised": advertised}, status_edit_params.StatusEditParams), + return await self._post( + f"/accounts/{account_id}/dlp/email/account_mapping", + body=await async_maybe_transform( + {"auth_requirements": auth_requirements}, account_mapping_create_params.AccountMappingCreateParams + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[StatusEditResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[AccountMappingCreateResponse]]._unwrapper, ), - cast_to=cast(Type[Optional[StatusEditResponse]], ResultWrapper[StatusEditResponse]), + cast_to=cast(Type[Optional[AccountMappingCreateResponse]], ResultWrapper[AccountMappingCreateResponse]), ) async def get( self, - prefix_id: str, *, account_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -220,15 +198,11 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[StatusGetResponse]: + ) -> Optional[AccountMappingGetResponse]: """ - List the current advertisement state for a prefix. + Get mapping Args: - account_id: Identifier - - prefix_id: Identifier - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -239,64 +213,62 @@ async def get( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not prefix_id: - raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") return await self._get( - f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/status", + f"/accounts/{account_id}/dlp/email/account_mapping", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[StatusGetResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[AccountMappingGetResponse]]._unwrapper, ), - cast_to=cast(Type[Optional[StatusGetResponse]], ResultWrapper[StatusGetResponse]), + cast_to=cast(Type[Optional[AccountMappingGetResponse]], ResultWrapper[AccountMappingGetResponse]), ) -class StatusesResourceWithRawResponse: - def __init__(self, statuses: StatusesResource) -> None: - self._statuses = statuses +class AccountMappingResourceWithRawResponse: + def __init__(self, account_mapping: AccountMappingResource) -> None: + self._account_mapping = account_mapping - self.edit = to_raw_response_wrapper( - statuses.edit, + self.create = to_raw_response_wrapper( + account_mapping.create, ) self.get = to_raw_response_wrapper( - statuses.get, + account_mapping.get, ) -class AsyncStatusesResourceWithRawResponse: - def __init__(self, statuses: AsyncStatusesResource) -> None: - self._statuses = statuses +class AsyncAccountMappingResourceWithRawResponse: + def __init__(self, account_mapping: AsyncAccountMappingResource) -> None: + self._account_mapping = account_mapping - self.edit = async_to_raw_response_wrapper( - statuses.edit, + self.create = async_to_raw_response_wrapper( + account_mapping.create, ) self.get = async_to_raw_response_wrapper( - statuses.get, + account_mapping.get, ) -class StatusesResourceWithStreamingResponse: - def __init__(self, statuses: StatusesResource) -> None: - self._statuses = statuses +class AccountMappingResourceWithStreamingResponse: + def __init__(self, account_mapping: AccountMappingResource) -> None: + self._account_mapping = account_mapping - self.edit = to_streamed_response_wrapper( - statuses.edit, + self.create = to_streamed_response_wrapper( + account_mapping.create, ) self.get = to_streamed_response_wrapper( - statuses.get, + account_mapping.get, ) -class AsyncStatusesResourceWithStreamingResponse: - def __init__(self, statuses: AsyncStatusesResource) -> None: - self._statuses = statuses +class AsyncAccountMappingResourceWithStreamingResponse: + def __init__(self, account_mapping: AsyncAccountMappingResource) -> None: + self._account_mapping = account_mapping - self.edit = async_to_streamed_response_wrapper( - statuses.edit, + self.create = async_to_streamed_response_wrapper( + account_mapping.create, ) self.get = async_to_streamed_response_wrapper( - statuses.get, + account_mapping.get, ) diff --git a/src/cloudflare/resources/zero_trust/dlp/email/email.py b/src/cloudflare/resources/zero_trust/dlp/email/email.py new file mode 100644 index 00000000000..5a860e81a40 --- /dev/null +++ b/src/cloudflare/resources/zero_trust/dlp/email/email.py @@ -0,0 +1,134 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .rules import ( + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, +) +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from .account_mapping import ( + AccountMappingResource, + AsyncAccountMappingResource, + AccountMappingResourceWithRawResponse, + AsyncAccountMappingResourceWithRawResponse, + AccountMappingResourceWithStreamingResponse, + AsyncAccountMappingResourceWithStreamingResponse, +) + +__all__ = ["EmailResource", "AsyncEmailResource"] + + +class EmailResource(SyncAPIResource): + @cached_property + def account_mapping(self) -> AccountMappingResource: + return AccountMappingResource(self._client) + + @cached_property + def rules(self) -> RulesResource: + return RulesResource(self._client) + + @cached_property + def with_raw_response(self) -> EmailResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return EmailResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> EmailResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return EmailResourceWithStreamingResponse(self) + + +class AsyncEmailResource(AsyncAPIResource): + @cached_property + def account_mapping(self) -> AsyncAccountMappingResource: + return AsyncAccountMappingResource(self._client) + + @cached_property + def rules(self) -> AsyncRulesResource: + return AsyncRulesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncEmailResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncEmailResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncEmailResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncEmailResourceWithStreamingResponse(self) + + +class EmailResourceWithRawResponse: + def __init__(self, email: EmailResource) -> None: + self._email = email + + @cached_property + def account_mapping(self) -> AccountMappingResourceWithRawResponse: + return AccountMappingResourceWithRawResponse(self._email.account_mapping) + + @cached_property + def rules(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self._email.rules) + + +class AsyncEmailResourceWithRawResponse: + def __init__(self, email: AsyncEmailResource) -> None: + self._email = email + + @cached_property + def account_mapping(self) -> AsyncAccountMappingResourceWithRawResponse: + return AsyncAccountMappingResourceWithRawResponse(self._email.account_mapping) + + @cached_property + def rules(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self._email.rules) + + +class EmailResourceWithStreamingResponse: + def __init__(self, email: EmailResource) -> None: + self._email = email + + @cached_property + def account_mapping(self) -> AccountMappingResourceWithStreamingResponse: + return AccountMappingResourceWithStreamingResponse(self._email.account_mapping) + + @cached_property + def rules(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self._email.rules) + + +class AsyncEmailResourceWithStreamingResponse: + def __init__(self, email: AsyncEmailResource) -> None: + self._email = email + + @cached_property + def account_mapping(self) -> AsyncAccountMappingResourceWithStreamingResponse: + return AsyncAccountMappingResourceWithStreamingResponse(self._email.account_mapping) + + @cached_property + def rules(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self._email.rules) diff --git a/src/cloudflare/resources/zero_trust/dlp/email/rules.py b/src/cloudflare/resources/zero_trust/dlp/email/rules.py new file mode 100644 index 00000000000..63906966157 --- /dev/null +++ b/src/cloudflare/resources/zero_trust/dlp/email/rules.py @@ -0,0 +1,701 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Type, Iterable, Optional, cast + +import httpx + +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._utils import ( + maybe_transform, + async_maybe_transform, +) +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage +from ....._base_client import AsyncPaginator, make_request_options +from .....types.zero_trust.dlp.email import rule_create_params, rule_update_params, rule_bulk_edit_params +from .....types.zero_trust.dlp.email.rule_get_response import RuleGetResponse +from .....types.zero_trust.dlp.email.rule_list_response import RuleListResponse +from .....types.zero_trust.dlp.email.rule_create_response import RuleCreateResponse +from .....types.zero_trust.dlp.email.rule_delete_response import RuleDeleteResponse +from .....types.zero_trust.dlp.email.rule_update_response import RuleUpdateResponse +from .....types.zero_trust.dlp.email.rule_bulk_edit_response import RuleBulkEditResponse + +__all__ = ["RulesResource", "AsyncRulesResource"] + + +class RulesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RulesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return RulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RulesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return RulesResourceWithStreamingResponse(self) + + def create( + self, + *, + account_id: str, + action: rule_create_params.Action, + conditions: Iterable[rule_create_params.Condition], + enabled: bool, + name: str, + description: Optional[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, + ) -> Optional[RuleCreateResponse]: + """ + Create email scanner rule + + Args: + conditions: Rule is triggered if all conditions match + + 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}/dlp/email/rules", + body=maybe_transform( + { + "action": action, + "conditions": conditions, + "enabled": enabled, + "name": name, + "description": description, + }, + rule_create_params.RuleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RuleCreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RuleCreateResponse]], ResultWrapper[RuleCreateResponse]), + ) + + def update( + self, + rule_id: str, + *, + account_id: str, + action: rule_update_params.Action, + conditions: Iterable[rule_update_params.Condition], + enabled: bool, + name: str, + description: Optional[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, + ) -> Optional[RuleUpdateResponse]: + """ + Update email scanner rule + + Args: + conditions: Rule is triggered if all conditions match + + 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 rule_id: + raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") + return self._put( + f"/accounts/{account_id}/dlp/email/rules/{rule_id}", + body=maybe_transform( + { + "action": action, + "conditions": conditions, + "enabled": enabled, + "name": name, + "description": description, + }, + rule_update_params.RuleUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RuleUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RuleUpdateResponse]], ResultWrapper[RuleUpdateResponse]), + ) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncSinglePage[RuleListResponse]: + """ + Lists all email scanner rules for an account. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/dlp/email/rules", + page=SyncSinglePage[RuleListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=RuleListResponse, + ) + + def delete( + self, + rule_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[RuleDeleteResponse]: + """ + Delete email scanner rule + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not rule_id: + raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") + return self._delete( + f"/accounts/{account_id}/dlp/email/rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RuleDeleteResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RuleDeleteResponse]], ResultWrapper[RuleDeleteResponse]), + ) + + def bulk_edit( + self, + *, + account_id: str, + new_priorities: Dict[str, int], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[RuleBulkEditResponse]: + """ + Update email scanner rule priorities + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._patch( + f"/accounts/{account_id}/dlp/email/rules", + body=maybe_transform({"new_priorities": new_priorities}, rule_bulk_edit_params.RuleBulkEditParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RuleBulkEditResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RuleBulkEditResponse]], ResultWrapper[RuleBulkEditResponse]), + ) + + def get( + self, + rule_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[RuleGetResponse]: + """ + Get an email scanner rule + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not rule_id: + raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") + return self._get( + f"/accounts/{account_id}/dlp/email/rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RuleGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RuleGetResponse]], ResultWrapper[RuleGetResponse]), + ) + + +class AsyncRulesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncRulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncRulesResourceWithStreamingResponse(self) + + async def create( + self, + *, + account_id: str, + action: rule_create_params.Action, + conditions: Iterable[rule_create_params.Condition], + enabled: bool, + name: str, + description: Optional[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, + ) -> Optional[RuleCreateResponse]: + """ + Create email scanner rule + + Args: + conditions: Rule is triggered if all conditions match + + 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}/dlp/email/rules", + body=await async_maybe_transform( + { + "action": action, + "conditions": conditions, + "enabled": enabled, + "name": name, + "description": description, + }, + rule_create_params.RuleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RuleCreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RuleCreateResponse]], ResultWrapper[RuleCreateResponse]), + ) + + async def update( + self, + rule_id: str, + *, + account_id: str, + action: rule_update_params.Action, + conditions: Iterable[rule_update_params.Condition], + enabled: bool, + name: str, + description: Optional[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, + ) -> Optional[RuleUpdateResponse]: + """ + Update email scanner rule + + Args: + conditions: Rule is triggered if all conditions match + + 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 rule_id: + raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") + return await self._put( + f"/accounts/{account_id}/dlp/email/rules/{rule_id}", + body=await async_maybe_transform( + { + "action": action, + "conditions": conditions, + "enabled": enabled, + "name": name, + "description": description, + }, + rule_update_params.RuleUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RuleUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RuleUpdateResponse]], ResultWrapper[RuleUpdateResponse]), + ) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[RuleListResponse, AsyncSinglePage[RuleListResponse]]: + """ + Lists all email scanner rules for an account. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/dlp/email/rules", + page=AsyncSinglePage[RuleListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=RuleListResponse, + ) + + async def delete( + self, + rule_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[RuleDeleteResponse]: + """ + Delete email scanner rule + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not rule_id: + raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") + return await self._delete( + f"/accounts/{account_id}/dlp/email/rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RuleDeleteResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RuleDeleteResponse]], ResultWrapper[RuleDeleteResponse]), + ) + + async def bulk_edit( + self, + *, + account_id: str, + new_priorities: Dict[str, int], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[RuleBulkEditResponse]: + """ + Update email scanner rule priorities + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return await self._patch( + f"/accounts/{account_id}/dlp/email/rules", + body=await async_maybe_transform( + {"new_priorities": new_priorities}, rule_bulk_edit_params.RuleBulkEditParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RuleBulkEditResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RuleBulkEditResponse]], ResultWrapper[RuleBulkEditResponse]), + ) + + async def get( + self, + rule_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[RuleGetResponse]: + """ + Get an email scanner rule + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not rule_id: + raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") + return await self._get( + f"/accounts/{account_id}/dlp/email/rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RuleGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RuleGetResponse]], ResultWrapper[RuleGetResponse]), + ) + + +class RulesResourceWithRawResponse: + def __init__(self, rules: RulesResource) -> None: + self._rules = rules + + self.create = to_raw_response_wrapper( + rules.create, + ) + self.update = to_raw_response_wrapper( + rules.update, + ) + self.list = to_raw_response_wrapper( + rules.list, + ) + self.delete = to_raw_response_wrapper( + rules.delete, + ) + self.bulk_edit = to_raw_response_wrapper( + rules.bulk_edit, + ) + self.get = to_raw_response_wrapper( + rules.get, + ) + + +class AsyncRulesResourceWithRawResponse: + def __init__(self, rules: AsyncRulesResource) -> None: + self._rules = rules + + self.create = async_to_raw_response_wrapper( + rules.create, + ) + self.update = async_to_raw_response_wrapper( + rules.update, + ) + self.list = async_to_raw_response_wrapper( + rules.list, + ) + self.delete = async_to_raw_response_wrapper( + rules.delete, + ) + self.bulk_edit = async_to_raw_response_wrapper( + rules.bulk_edit, + ) + self.get = async_to_raw_response_wrapper( + rules.get, + ) + + +class RulesResourceWithStreamingResponse: + def __init__(self, rules: RulesResource) -> None: + self._rules = rules + + self.create = to_streamed_response_wrapper( + rules.create, + ) + self.update = to_streamed_response_wrapper( + rules.update, + ) + self.list = to_streamed_response_wrapper( + rules.list, + ) + self.delete = to_streamed_response_wrapper( + rules.delete, + ) + self.bulk_edit = to_streamed_response_wrapper( + rules.bulk_edit, + ) + self.get = to_streamed_response_wrapper( + rules.get, + ) + + +class AsyncRulesResourceWithStreamingResponse: + def __init__(self, rules: AsyncRulesResource) -> None: + self._rules = rules + + self.create = async_to_streamed_response_wrapper( + rules.create, + ) + self.update = async_to_streamed_response_wrapper( + rules.update, + ) + self.list = async_to_streamed_response_wrapper( + rules.list, + ) + self.delete = async_to_streamed_response_wrapper( + rules.delete, + ) + self.bulk_edit = async_to_streamed_response_wrapper( + rules.bulk_edit, + ) + self.get = async_to_streamed_response_wrapper( + rules.get, + ) diff --git a/src/cloudflare/resources/zero_trust/gateway/configurations/configurations.py b/src/cloudflare/resources/zero_trust/gateway/configurations/configurations.py index 4ebaf1a42d5..269e71f769f 100755 --- a/src/cloudflare/resources/zero_trust/gateway/configurations/configurations.py +++ b/src/cloudflare/resources/zero_trust/gateway/configurations/configurations.py @@ -81,7 +81,7 @@ def update( Updates the current Zero Trust account configuration. Args: - settings: account settings. + settings: Account settings extra_headers: Send extra headers @@ -127,7 +127,7 @@ def edit( error if any collection of settings is not properly configured. Args: - settings: account settings. + settings: Account settings extra_headers: Send extra headers @@ -230,7 +230,7 @@ async def update( Updates the current Zero Trust account configuration. Args: - settings: account settings. + settings: Account settings extra_headers: Send extra headers @@ -278,7 +278,7 @@ async def edit( error if any collection of settings is not properly configured. Args: - settings: account settings. + settings: Account settings extra_headers: Send extra headers diff --git a/src/cloudflare/resources/zero_trust/gateway/lists/lists.py b/src/cloudflare/resources/zero_trust/gateway/lists/lists.py index db84089871a..324a7de6194 100644 --- a/src/cloudflare/resources/zero_trust/gateway/lists/lists.py +++ b/src/cloudflare/resources/zero_trust/gateway/lists/lists.py @@ -128,6 +128,7 @@ def update( account_id: str, name: str, description: str | NotGiven = NOT_GIVEN, + items: Iterable[GatewayItemParam] | 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, @@ -135,8 +136,10 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[GatewayList]: - """ - Updates a configured Zero Trust list. + """Updates a configured Zero Trust list. + + Skips updating list items if not included + in the payload. Args: list_id: API Resource UUID tag. @@ -145,6 +148,8 @@ def update( description: The description of the list. + items: The items in the list. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -163,6 +168,7 @@ def update( { "name": name, "description": description, + "items": items, }, list_update_params.ListUpdateParams, ), @@ -446,6 +452,7 @@ async def update( account_id: str, name: str, description: str | NotGiven = NOT_GIVEN, + items: Iterable[GatewayItemParam] | 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, @@ -453,8 +460,10 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[GatewayList]: - """ - Updates a configured Zero Trust list. + """Updates a configured Zero Trust list. + + Skips updating list items if not included + in the payload. Args: list_id: API Resource UUID tag. @@ -463,6 +472,8 @@ async def update( description: The description of the list. + items: The items in the list. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -481,6 +492,7 @@ async def update( { "name": name, "description": description, + "items": items, }, list_update_params.ListUpdateParams, ), diff --git a/src/cloudflare/resources/zero_trust/organizations/doh.py b/src/cloudflare/resources/zero_trust/organizations/doh.py index d16604fe4b7..70518bc0925 100644 --- a/src/cloudflare/resources/zero_trust/organizations/doh.py +++ b/src/cloudflare/resources/zero_trust/organizations/doh.py @@ -52,7 +52,7 @@ def update( self, *, account_id: str, - jwt_duration: str | NotGiven = NOT_GIVEN, + doh_jwt_duration: str | NotGiven = NOT_GIVEN, service_token_id: 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. @@ -67,7 +67,7 @@ def update( Args: account_id: Identifier - jwt_duration: The duration the DoH JWT is valid for. Must be in the format `300ms` or `2h45m`. + doh_jwt_duration: The duration the DoH JWT is valid for. Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, m, h. Note that the maximum duration for this setting is the same as the key rotation period on the account. Default expiration is 24h @@ -88,7 +88,7 @@ def update( f"/accounts/{account_id}/access/organizations/doh", body=maybe_transform( { - "jwt_duration": jwt_duration, + "doh_jwt_duration": doh_jwt_duration, "service_token_id": service_token_id, }, doh_update_params.DOHUpdateParams, @@ -167,7 +167,7 @@ async def update( self, *, account_id: str, - jwt_duration: str | NotGiven = NOT_GIVEN, + doh_jwt_duration: str | NotGiven = NOT_GIVEN, service_token_id: 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. @@ -182,7 +182,7 @@ async def update( Args: account_id: Identifier - jwt_duration: The duration the DoH JWT is valid for. Must be in the format `300ms` or `2h45m`. + doh_jwt_duration: The duration the DoH JWT is valid for. Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, m, h. Note that the maximum duration for this setting is the same as the key rotation period on the account. Default expiration is 24h @@ -203,7 +203,7 @@ async def update( f"/accounts/{account_id}/access/organizations/doh", body=await async_maybe_transform( { - "jwt_duration": jwt_duration, + "doh_jwt_duration": doh_jwt_duration, "service_token_id": service_token_id, }, doh_update_params.DOHUpdateParams, diff --git a/src/cloudflare/resources/zones/holds.py b/src/cloudflare/resources/zones/holds.py index 890ce0319b9..50ff188a172 100644 --- a/src/cloudflare/resources/zones/holds.py +++ b/src/cloudflare/resources/zones/holds.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, cast import httpx @@ -20,7 +20,7 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.zones import hold_create_params, hold_delete_params +from ...types.zones import hold_edit_params, hold_create_params, hold_delete_params from ..._base_client import make_request_options from ...types.zones.zone_hold import ZoneHold @@ -105,7 +105,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneHold]: + ) -> ZoneHold: """ Stop enforcement of a zone hold on the zone, permanently or temporarily, allowing the creation and activation of zones with this zone's hostname. @@ -135,9 +135,69 @@ def delete( extra_body=extra_body, timeout=timeout, query=maybe_transform({"hold_after": hold_after}, hold_delete_params.HoldDeleteParams), - post_parser=ResultWrapper[Optional[ZoneHold]]._unwrapper, + post_parser=ResultWrapper[ZoneHold]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneHold]], ResultWrapper[ZoneHold]), + cast_to=cast(Type[ZoneHold], ResultWrapper[ZoneHold]), + ) + + def edit( + self, + *, + zone_id: str, + hold_after: str | NotGiven = NOT_GIVEN, + include_subdomains: 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, + ) -> ZoneHold: + """ + Update the `hold_after` and/or `include_subdomains` values on an existing zone + hold. The hold is enabled if the `hold_after` date-time value is in the past. + + Args: + zone_id: Identifier + + hold_after: If `hold_after` is provided and future-dated, the hold will be temporarily + disabled, then automatically re-enabled by the system at the time specified in + this RFC3339-formatted timestamp. A past-dated `hold_after` value will have no + effect on an existing, enabled hold. Providing an empty string will set its + value to the current time. + + include_subdomains: If `true`, the zone hold will extend to block any subdomain of the given zone, + as well as SSL4SaaS Custom Hostnames. For example, a zone hold on a zone with + the hostname 'example.com' and include_subdomains=true will block 'example.com', + 'staging.example.com', 'api.staging.example.com', etc. + + 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 zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return self._patch( + f"/zones/{zone_id}/hold", + body=maybe_transform( + { + "hold_after": hold_after, + "include_subdomains": include_subdomains, + }, + hold_edit_params.HoldEditParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ZoneHold]._unwrapper, + ), + cast_to=cast(Type[ZoneHold], ResultWrapper[ZoneHold]), ) def get( @@ -261,7 +321,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneHold]: + ) -> ZoneHold: """ Stop enforcement of a zone hold on the zone, permanently or temporarily, allowing the creation and activation of zones with this zone's hostname. @@ -291,9 +351,69 @@ async def delete( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"hold_after": hold_after}, hold_delete_params.HoldDeleteParams), - post_parser=ResultWrapper[Optional[ZoneHold]]._unwrapper, + post_parser=ResultWrapper[ZoneHold]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneHold]], ResultWrapper[ZoneHold]), + cast_to=cast(Type[ZoneHold], ResultWrapper[ZoneHold]), + ) + + async def edit( + self, + *, + zone_id: str, + hold_after: str | NotGiven = NOT_GIVEN, + include_subdomains: 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, + ) -> ZoneHold: + """ + Update the `hold_after` and/or `include_subdomains` values on an existing zone + hold. The hold is enabled if the `hold_after` date-time value is in the past. + + Args: + zone_id: Identifier + + hold_after: If `hold_after` is provided and future-dated, the hold will be temporarily + disabled, then automatically re-enabled by the system at the time specified in + this RFC3339-formatted timestamp. A past-dated `hold_after` value will have no + effect on an existing, enabled hold. Providing an empty string will set its + value to the current time. + + include_subdomains: If `true`, the zone hold will extend to block any subdomain of the given zone, + as well as SSL4SaaS Custom Hostnames. For example, a zone hold on a zone with + the hostname 'example.com' and include_subdomains=true will block 'example.com', + 'staging.example.com', 'api.staging.example.com', etc. + + 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 zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return await self._patch( + f"/zones/{zone_id}/hold", + body=await async_maybe_transform( + { + "hold_after": hold_after, + "include_subdomains": include_subdomains, + }, + hold_edit_params.HoldEditParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ZoneHold]._unwrapper, + ), + cast_to=cast(Type[ZoneHold], ResultWrapper[ZoneHold]), ) async def get( @@ -347,6 +467,9 @@ def __init__(self, holds: HoldsResource) -> None: self.delete = to_raw_response_wrapper( holds.delete, ) + self.edit = to_raw_response_wrapper( + holds.edit, + ) self.get = to_raw_response_wrapper( holds.get, ) @@ -362,6 +485,9 @@ def __init__(self, holds: AsyncHoldsResource) -> None: self.delete = async_to_raw_response_wrapper( holds.delete, ) + self.edit = async_to_raw_response_wrapper( + holds.edit, + ) self.get = async_to_raw_response_wrapper( holds.get, ) @@ -377,6 +503,9 @@ def __init__(self, holds: HoldsResource) -> None: self.delete = to_streamed_response_wrapper( holds.delete, ) + self.edit = to_streamed_response_wrapper( + holds.edit, + ) self.get = to_streamed_response_wrapper( holds.get, ) @@ -392,6 +521,9 @@ def __init__(self, holds: AsyncHoldsResource) -> None: self.delete = async_to_streamed_response_wrapper( holds.delete, ) + self.edit = async_to_streamed_response_wrapper( + holds.edit, + ) self.get = async_to_streamed_response_wrapper( holds.get, ) diff --git a/src/cloudflare/types/abuse_reports/__init__.py b/src/cloudflare/types/abuse_reports/__init__.py new file mode 100644 index 00000000000..c17465cb40c --- /dev/null +++ b/src/cloudflare/types/abuse_reports/__init__.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .abuse_report_create_params import AbuseReportCreateParams as AbuseReportCreateParams +from .abuse_report_create_response import AbuseReportCreateResponse as AbuseReportCreateResponse diff --git a/src/cloudflare/types/abuse_reports/abuse_report_create_params.py b/src/cloudflare/types/abuse_reports/abuse_report_create_params.py new file mode 100644 index 00000000000..ff19f93f7c5 --- /dev/null +++ b/src/cloudflare/types/abuse_reports/abuse_report_create_params.py @@ -0,0 +1,140 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["AbuseReportCreateParams"] + + +class AbuseReportCreateParams(TypedDict, total=False): + account_id: Required[str] + + act: Required[ + Literal[ + "abuse_dmca", + "abuse_trademark", + "abuse_general", + "abuse_phishing", + "abuse_children", + "abuse_threat", + "abuse_registrar_whois", + "abuse_ncsei", + ] + ] + """The abuse report type""" + + email: Required[str] + """A valid email of the abuse reporter""" + + email2: Required[str] + """Should match the value provided in `email`""" + + host_notification: Required[Literal["send", "send-anon", "none"]] + """Notification type based on the abuse type. + + NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. + """ + + ncmec_notification: Required[Literal["send", "send-anon", "none"]] + """Notification type based on the abuse type. + + NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. + """ + + owner_notification: Required[Literal["send", "send-anon", "none"]] + """Notification type based on the abuse type. + + NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. + """ + + urls: Required[str] + """A list of valid URLs separated by ‘ ’ (new line character). + + The list of the URLs should not exceed 250 URLs. All URLs should have the same + hostname. Each URL should be unique + """ + + address1: str + """Text not exceeding 100 characters""" + + agent_name: str + """The name of the copyright holder. Text not exceeding 60 characters.""" + + agree: Literal[0, 1] + """Can be 0 or 1""" + + city: str + """Text not exceeding 255 characters""" + + comments: str + """Any additional comments about the infringement not exceeding 2000 characters""" + + company: str + """Text not exceeding 100 characters""" + + country: str + """Text not exceeding 255 characters""" + + destination_ips: str + """A list of IP addresses separated by ‘ ’ (new line character). + + The list of destination IPs should not exceed 30 IP addresses. Each one of the + IP addresses ought to be unique + """ + + justification: str + """ + A detailed description of the infringement, including any necessary access + details and the exact steps needed to view the content, not exceeding 5000 + characters + """ + + name: str + """Text not exceeding 255 characters""" + + ncsei_subject_representation: bool + """If the submitter is the target of NCSEI in the URLs of the abuse report""" + + original_work: str + """Text not exceeding 255 characters""" + + ports_protocols: str + """A comma separated list of ports and protocols e.g. + + 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. + Each individual port/protocol should not exceed 100 characters. The list should + not have more than 30 unique ports and protocols. + """ + + signature: str + """Required for DMCA reports, should be same as Name. + + An affirmation that all information in the report is true and accurate while + agreeing to the policies of Cloudflare's abuse reports + """ + + source_ips: str + """A list of IP addresses separated by ‘ ’ (new line character). + + The list of source IPs should not exceed 30 IP addresses. Each one of the IP + addresses ought to be unique + """ + + state: str + """Text not exceeding 255 characters""" + + tele: str + """Text not exceeding 20 characters""" + + title: str + """Text not exceeding 255 characters""" + + trademark_number: str + """Text not exceeding 1000 characters""" + + trademark_office: str + """Text not exceeding 1000 characters""" + + trademark_symbol: str + """Text not exceeding 1000 characters""" diff --git a/src/cloudflare/types/abuse_reports/abuse_report_create_response.py b/src/cloudflare/types/abuse_reports/abuse_report_create_response.py new file mode 100644 index 00000000000..03fc4011e68 --- /dev/null +++ b/src/cloudflare/types/abuse_reports/abuse_report_create_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import TypeAlias + +__all__ = ["AbuseReportCreateResponse"] + +AbuseReportCreateResponse: TypeAlias = str diff --git a/src/cloudflare/types/accounts/logs/__init__.py b/src/cloudflare/types/accounts/logs/__init__.py new file mode 100644 index 00000000000..4db884733b2 --- /dev/null +++ b/src/cloudflare/types/accounts/logs/__init__.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .audit_list_params import AuditListParams as AuditListParams +from .audit_list_response import AuditListResponse as AuditListResponse diff --git a/src/cloudflare/types/accounts/logs/audit_list_params.py b/src/cloudflare/types/accounts/logs/audit_list_params.py new file mode 100644 index 00000000000..0d0bd685341 --- /dev/null +++ b/src/cloudflare/types/accounts/logs/audit_list_params.py @@ -0,0 +1,115 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import date +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["AuditListParams"] + + +class AuditListParams(TypedDict, total=False): + account_id: Required[str] + """The unique id that identifies the account.""" + + before: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """ + Filters actions based on a given timestamp in the format yyyy-mm-dd, returning + only logs that occurred on and before the specified date. + """ + + since: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """ + Filters actions based on a given timestamp in the format yyyy-mm-dd, returning + only logs that occurred on and after the specified date. + """ + + account_name: str + """Filters by the account name.""" + + action_result: Literal["success", "failure"] + """Whether the action was successful or not.""" + + action_type: Literal["create", "delete", "view", "update"] + """Filters by the action type.""" + + actor_context: Literal["api_key", "api_token", "dash", "oauth", "origin_ca_key"] + """Filters by the actor context.""" + + actor_email: str + """Filters by the actor's email address.""" + + actor_id: str + """Filters by the actor ID. This can be either the Account ID or User ID.""" + + actor_ip_address: str + """The IP address where the action was initiated.""" + + actor_token_id: str + """Filters by the API token ID when the actor context is an api_token or oauth.""" + + actor_token_name: str + """Filters by the API token name when the actor context is an api_token or oauth.""" + + actor_type: Literal["cloudflare_admin", "account", "user"] + """Filters by the actor type.""" + + audit_log_id: str + """Finds a specific log by its ID.""" + + cursor: str + """The cursor is an opaque token used to paginate through large sets of records. + + It indicates the position from which to continue when requesting the next set of + records. A valid cursor value can be obtained from the cursor object in the + result_info structure of a previous response. + """ + + direction: Literal["desc", "asc"] + """Sets sorting order.""" + + limit: float + """The number limits the objects to return. + + The cursor attribute may be used to iterate over the next batch of objects if + there are more than the limit. + """ + + raw_cf_rayid: Annotated[str, PropertyInfo(alias="raw_cf_ray_id")] + """Filters by the response CF Ray ID.""" + + raw_method: str + """The HTTP method for the API call.""" + + raw_status_code: int + """The response status code that was returned.""" + + raw_uri: str + """Filters by the request URI.""" + + resource_id: str + """Filters by the resource ID.""" + + resource_product: str + """ + Filters audit logs by the Cloudflare product associated with the changed + resource. + """ + + resource_scope: Literal["accounts", "user", "zones"] + """ + Filters by the resource scope, specifying whether the resource is associated + with an user, an account, or a zone. + """ + + resource_type: str + """Filters audit logs based on the unique type of resource changed by the action.""" + + zone_id: str + """Filters by the zone ID.""" + + zone_name: str + """Filters by the zone name associated with the change.""" diff --git a/src/cloudflare/types/accounts/logs/audit_list_response.py b/src/cloudflare/types/accounts/logs/audit_list_response.py new file mode 100644 index 00000000000..ec2281163c6 --- /dev/null +++ b/src/cloudflare/types/accounts/logs/audit_list_response.py @@ -0,0 +1,124 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["AuditListResponse", "Account", "Action", "Actor", "Raw", "Resource", "Zone"] + + +class Account(BaseModel): + id: Optional[str] = None + """A unique identifier for the account.""" + + name: Optional[str] = None + """A string that identifies the account name.""" + + +class Action(BaseModel): + description: Optional[str] = None + """A short description of the action performed.""" + + result: Optional[str] = None + """The result of the action, indicating success or failure.""" + + time: Optional[datetime] = None + """A timestamp indicating when the action was logged.""" + + 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 who performed the action. + + If a user performed the action, this will be their User ID. + """ + + context: Optional[Literal["api_key", "api_token", "dash", "oauth", "origin_ca_key"]] = None + + email: Optional[str] = None + """The email of the actor who performed the action.""" + + ip_address: Optional[str] = None + """The IP address of the request that performed the action.""" + + token_id: Optional[str] = None + """Filters by the API token ID when the actor context is an api_token.""" + + token_name: Optional[str] = None + """Filters by the API token name when the actor context is an api_token.""" + + type: Optional[Literal["user", "account", "cloudflare-admin"]] = None + """The type of actor.""" + + +class Raw(BaseModel): + cf_rayid: Optional[str] = FieldInfo(alias="cf_ray_id", default=None) + """The Cloudflare Ray ID for the request.""" + + method: Optional[str] = None + """The HTTP method of the request.""" + + status_code: Optional[int] = None + """The HTTP response status code returned by the API.""" + + uri: Optional[str] = None + """The URI of the request.""" + + user_agent: Optional[str] = None + """The client's user agent string sent with the request.""" + + +class Resource(BaseModel): + id: Optional[str] = None + """The unique identifier for the affected resource.""" + + product: Optional[str] = None + """The Cloudflare product associated with the resource.""" + + request: Optional[object] = None + + response: Optional[object] = None + + scope: Optional[object] = None + """The scope of the resource.""" + + type: Optional[str] = None + """The type of the resource.""" + + +class Zone(BaseModel): + id: Optional[str] = None + """A string that identifies the zone id.""" + + name: Optional[str] = None + """A string that identifies the zone name.""" + + +class AuditListResponse(BaseModel): + id: Optional[str] = None + """A unique identifier for the audit log entry.""" + + account: Optional[Account] = None + """Contains account related information.""" + + action: Optional[Action] = None + """Provides information about the action performed.""" + + actor: Optional[Actor] = None + """Provides details about the actor who performed the action.""" + + raw: Optional[Raw] = None + """Provides raw information about the request and response.""" + + resource: Optional[Resource] = None + """Provides details about the affected resource.""" + + zone: Optional[Zone] = None + """Provides details about the zone affected by the action.""" diff --git a/src/cloudflare/types/accounts/token_create_params.py b/src/cloudflare/types/accounts/token_create_params.py index aca51228744..e94512a93f9 100644 --- a/src/cloudflare/types/accounts/token_create_params.py +++ b/src/cloudflare/types/accounts/token_create_params.py @@ -50,5 +50,5 @@ class ConditionRequestIP(_ConditionRequestIPReservedKeywords, total=False): class Condition(TypedDict, total=False): - request_ip: Annotated[ConditionRequestIP, PropertyInfo(alias="request.ip")] + request_ip: ConditionRequestIP """Client IP restrictions.""" diff --git a/src/cloudflare/types/accounts/token_create_response.py b/src/cloudflare/types/accounts/token_create_response.py index cfc75aba10c..baad5983f71 100644 --- a/src/cloudflare/types/accounts/token_create_response.py +++ b/src/cloudflare/types/accounts/token_create_response.py @@ -23,7 +23,7 @@ class ConditionRequestIP(BaseModel): class Condition(BaseModel): - request_ip: Optional[ConditionRequestIP] = FieldInfo(alias="request.ip", default=None) + request_ip: Optional[ConditionRequestIP] = None """Client IP restrictions.""" diff --git a/src/cloudflare/types/accounts/token_update_params.py b/src/cloudflare/types/accounts/token_update_params.py index 1968327cffa..bec89b38118 100644 --- a/src/cloudflare/types/accounts/token_update_params.py +++ b/src/cloudflare/types/accounts/token_update_params.py @@ -53,5 +53,5 @@ class ConditionRequestIP(_ConditionRequestIPReservedKeywords, total=False): class Condition(TypedDict, total=False): - request_ip: Annotated[ConditionRequestIP, PropertyInfo(alias="request.ip")] + request_ip: ConditionRequestIP """Client IP restrictions.""" diff --git a/src/cloudflare/types/addressing/address_map.py b/src/cloudflare/types/addressing/address_map.py index dff7660e50c..1ff0f0ab4f2 100644 --- a/src/cloudflare/types/addressing/address_map.py +++ b/src/cloudflare/types/addressing/address_map.py @@ -10,7 +10,7 @@ class AddressMap(BaseModel): id: Optional[str] = None - """Identifier""" + """Identifier of an Address Map.""" can_delete: Optional[bool] = None """If set to false, then the Address Map cannot be deleted via API. diff --git a/src/cloudflare/types/addressing/address_map_create_params.py b/src/cloudflare/types/addressing/address_map_create_params.py index ac313102d61..bef1dcc72a9 100644 --- a/src/cloudflare/types/addressing/address_map_create_params.py +++ b/src/cloudflare/types/addressing/address_map_create_params.py @@ -12,7 +12,7 @@ class AddressMapCreateParams(TypedDict, total=False): account_id: Required[str] - """Identifier""" + """Identifier of a Cloudflare account.""" description: Optional[str] """ diff --git a/src/cloudflare/types/addressing/address_map_create_response.py b/src/cloudflare/types/addressing/address_map_create_response.py index 032e1166d18..08303310e4e 100644 --- a/src/cloudflare/types/addressing/address_map_create_response.py +++ b/src/cloudflare/types/addressing/address_map_create_response.py @@ -31,7 +31,7 @@ class Membership(BaseModel): class AddressMapCreateResponse(BaseModel): id: Optional[str] = None - """Identifier""" + """Identifier of an Address Map.""" can_delete: Optional[bool] = None """If set to false, then the Address Map cannot be deleted via API. diff --git a/src/cloudflare/types/addressing/address_map_edit_params.py b/src/cloudflare/types/addressing/address_map_edit_params.py index 5d91c15dab3..78a94270693 100644 --- a/src/cloudflare/types/addressing/address_map_edit_params.py +++ b/src/cloudflare/types/addressing/address_map_edit_params.py @@ -10,7 +10,7 @@ class AddressMapEditParams(TypedDict, total=False): account_id: Required[str] - """Identifier""" + """Identifier of a Cloudflare account.""" default_sni: Optional[str] """ diff --git a/src/cloudflare/types/addressing/address_map_get_response.py b/src/cloudflare/types/addressing/address_map_get_response.py index 0eb306ccdbd..2eda9977d94 100644 --- a/src/cloudflare/types/addressing/address_map_get_response.py +++ b/src/cloudflare/types/addressing/address_map_get_response.py @@ -31,7 +31,7 @@ class Membership(BaseModel): class AddressMapGetResponse(BaseModel): id: Optional[str] = None - """Identifier""" + """Identifier of an Address Map.""" can_delete: Optional[bool] = None """If set to false, then the Address Map cannot be deleted via API. diff --git a/src/cloudflare/types/addressing/address_maps/account_update_params.py b/src/cloudflare/types/addressing/address_maps/account_update_params.py index f06483675c1..ff618f7f917 100644 --- a/src/cloudflare/types/addressing/address_maps/account_update_params.py +++ b/src/cloudflare/types/addressing/address_maps/account_update_params.py @@ -9,6 +9,6 @@ class AccountUpdateParams(TypedDict, total=False): account_id: Required[str] - """Identifier""" + """Identifier of a Cloudflare account.""" body: Required[object] diff --git a/src/cloudflare/types/addressing/address_maps/ip_update_params.py b/src/cloudflare/types/addressing/address_maps/ip_update_params.py index 41cd04d50b1..7c4e1611411 100644 --- a/src/cloudflare/types/addressing/address_maps/ip_update_params.py +++ b/src/cloudflare/types/addressing/address_maps/ip_update_params.py @@ -9,9 +9,9 @@ class IPUpdateParams(TypedDict, total=False): account_id: Required[str] - """Identifier""" + """Identifier of a Cloudflare account.""" address_map_id: Required[str] - """Identifier""" + """Identifier of an Address Map.""" body: Required[object] diff --git a/src/cloudflare/types/addressing/address_maps/zone_update_params.py b/src/cloudflare/types/addressing/address_maps/zone_update_params.py index 3cd7060a7ed..04047f85fc0 100644 --- a/src/cloudflare/types/addressing/address_maps/zone_update_params.py +++ b/src/cloudflare/types/addressing/address_maps/zone_update_params.py @@ -9,9 +9,9 @@ class ZoneUpdateParams(TypedDict, total=False): zone_id: Required[str] - """Identifier""" + """Identifier of a zone.""" account_id: Required[str] - """Identifier""" + """Identifier of a Cloudflare account.""" body: Required[object] diff --git a/src/cloudflare/types/addressing/loa_document_create_params.py b/src/cloudflare/types/addressing/loa_document_create_params.py index 4f8da69a2a5..3ea6bd6de69 100644 --- a/src/cloudflare/types/addressing/loa_document_create_params.py +++ b/src/cloudflare/types/addressing/loa_document_create_params.py @@ -9,7 +9,7 @@ class LOADocumentCreateParams(TypedDict, total=False): account_id: Required[str] - """Identifier""" + """Identifier of a Cloudflare account.""" loa_document: Required[str] """LOA document to upload.""" diff --git a/src/cloudflare/types/addressing/loa_document_create_response.py b/src/cloudflare/types/addressing/loa_document_create_response.py index 915d2b130c4..dd84b6a3b39 100644 --- a/src/cloudflare/types/addressing/loa_document_create_response.py +++ b/src/cloudflare/types/addressing/loa_document_create_response.py @@ -13,7 +13,7 @@ class LOADocumentCreateResponse(BaseModel): """Identifier for the uploaded LOA document.""" account_id: Optional[str] = None - """Identifier""" + """Identifier of a Cloudflare account.""" created: Optional[datetime] = None diff --git a/src/cloudflare/types/addressing/loa_documents/__init__.py b/src/cloudflare/types/addressing/loa_documents/__init__.py deleted file mode 100644 index f8ee8b14b1c..00000000000 --- a/src/cloudflare/types/addressing/loa_documents/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations diff --git a/src/cloudflare/types/addressing/prefix.py b/src/cloudflare/types/addressing/prefix.py index 9dd12947704..7a680d672f4 100644 --- a/src/cloudflare/types/addressing/prefix.py +++ b/src/cloudflare/types/addressing/prefix.py @@ -10,10 +10,10 @@ class Prefix(BaseModel): id: Optional[str] = None - """Identifier""" + """Identifier of an IP Prefix.""" account_id: Optional[str] = None - """Identifier""" + """Identifier of a Cloudflare account.""" advertised: Optional[bool] = None """Prefix advertisement status to the Internet. diff --git a/src/cloudflare/types/addressing/prefix_create_params.py b/src/cloudflare/types/addressing/prefix_create_params.py index edbe51ebcf4..b2d40ba7d01 100644 --- a/src/cloudflare/types/addressing/prefix_create_params.py +++ b/src/cloudflare/types/addressing/prefix_create_params.py @@ -10,7 +10,7 @@ class PrefixCreateParams(TypedDict, total=False): account_id: Required[str] - """Identifier""" + """Identifier of a Cloudflare account.""" asn: Required[Optional[int]] """Autonomous System Number (ASN) the prefix will be advertised under.""" diff --git a/src/cloudflare/types/addressing/prefix_edit_params.py b/src/cloudflare/types/addressing/prefix_edit_params.py index 9f4b08a8b40..b1ad60bb46f 100644 --- a/src/cloudflare/types/addressing/prefix_edit_params.py +++ b/src/cloudflare/types/addressing/prefix_edit_params.py @@ -9,7 +9,7 @@ class PrefixEditParams(TypedDict, total=False): account_id: Required[str] - """Identifier""" + """Identifier of a Cloudflare account.""" description: Required[str] """Description of the prefix.""" diff --git a/src/cloudflare/types/addressing/prefixes/__init__.py b/src/cloudflare/types/addressing/prefixes/__init__.py index 3f5ae7763da..70970ffbada 100644 --- a/src/cloudflare/types/addressing/prefixes/__init__.py +++ b/src/cloudflare/types/addressing/prefixes/__init__.py @@ -2,6 +2,15 @@ from __future__ import annotations +from .bgp_prefix import BGPPrefix as BGPPrefix from .delegations import Delegations as Delegations +from .service_binding import ServiceBinding as ServiceBinding +from .bgp_prefix_edit_params import BGPPrefixEditParams as BGPPrefixEditParams +from .bgp_prefix_create_params import BGPPrefixCreateParams as BGPPrefixCreateParams from .delegation_create_params import DelegationCreateParams as DelegationCreateParams from .delegation_delete_response import DelegationDeleteResponse as DelegationDeleteResponse +from .service_binding_create_params import ServiceBindingCreateParams as ServiceBindingCreateParams +from .service_binding_delete_response import ServiceBindingDeleteResponse as ServiceBindingDeleteResponse +from .advertisement_status_edit_params import AdvertisementStatusEditParams as AdvertisementStatusEditParams +from .advertisement_status_get_response import AdvertisementStatusGetResponse as AdvertisementStatusGetResponse +from .advertisement_status_edit_response import AdvertisementStatusEditResponse as AdvertisementStatusEditResponse diff --git a/src/cloudflare/types/addressing/prefixes/advertisement_status_edit_params.py b/src/cloudflare/types/addressing/prefixes/advertisement_status_edit_params.py new file mode 100644 index 00000000000..5de84a7f1d0 --- /dev/null +++ b/src/cloudflare/types/addressing/prefixes/advertisement_status_edit_params.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["AdvertisementStatusEditParams"] + + +class AdvertisementStatusEditParams(TypedDict, total=False): + account_id: Required[str] + """Identifier of a Cloudflare account.""" + + advertised: Required[bool] + """Advertisement status of the prefix. + + If `true`, the BGP route for the prefix is advertised to the Internet. If + `false`, the BGP route is withdrawn. + """ diff --git a/src/cloudflare/types/addressing/prefixes/bgp/status_get_response.py b/src/cloudflare/types/addressing/prefixes/advertisement_status_edit_response.py similarity index 54% rename from src/cloudflare/types/addressing/prefixes/bgp/status_get_response.py rename to src/cloudflare/types/addressing/prefixes/advertisement_status_edit_response.py index a6012cb77de..3c32d04dfcd 100644 --- a/src/cloudflare/types/addressing/prefixes/bgp/status_get_response.py +++ b/src/cloudflare/types/addressing/prefixes/advertisement_status_edit_response.py @@ -3,14 +3,18 @@ from typing import Optional from datetime import datetime -from ....._models import BaseModel +from ...._models import BaseModel -__all__ = ["StatusGetResponse"] +__all__ = ["AdvertisementStatusEditResponse"] -class StatusGetResponse(BaseModel): +class AdvertisementStatusEditResponse(BaseModel): advertised: Optional[bool] = None - """Enablement of prefix advertisement to the Internet.""" + """Advertisement status of the prefix. + + If `true`, the BGP route for the prefix is advertised to the Internet. If + `false`, the BGP route is withdrawn. + """ advertised_modified_at: Optional[datetime] = None """Last time the advertisement status was changed. diff --git a/src/cloudflare/types/addressing/prefixes/bgp/status_edit_response.py b/src/cloudflare/types/addressing/prefixes/advertisement_status_get_response.py similarity index 54% rename from src/cloudflare/types/addressing/prefixes/bgp/status_edit_response.py rename to src/cloudflare/types/addressing/prefixes/advertisement_status_get_response.py index f67cfc5baef..86260979361 100644 --- a/src/cloudflare/types/addressing/prefixes/bgp/status_edit_response.py +++ b/src/cloudflare/types/addressing/prefixes/advertisement_status_get_response.py @@ -3,14 +3,18 @@ from typing import Optional from datetime import datetime -from ....._models import BaseModel +from ...._models import BaseModel -__all__ = ["StatusEditResponse"] +__all__ = ["AdvertisementStatusGetResponse"] -class StatusEditResponse(BaseModel): +class AdvertisementStatusGetResponse(BaseModel): advertised: Optional[bool] = None - """Enablement of prefix advertisement to the Internet.""" + """Advertisement status of the prefix. + + If `true`, the BGP route for the prefix is advertised to the Internet. If + `false`, the BGP route is withdrawn. + """ advertised_modified_at: Optional[datetime] = None """Last time the advertisement status was changed. diff --git a/src/cloudflare/types/addressing/prefixes/bgp/__init__.py b/src/cloudflare/types/addressing/prefixes/bgp/__init__.py deleted file mode 100644 index bf70ca01135..00000000000 --- a/src/cloudflare/types/addressing/prefixes/bgp/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .bgp_prefix import BGPPrefix as BGPPrefix -from .service_binding import ServiceBinding as ServiceBinding -from .prefix_edit_params import PrefixEditParams as PrefixEditParams -from .status_edit_params import StatusEditParams as StatusEditParams -from .status_get_response import StatusGetResponse as StatusGetResponse -from .status_edit_response import StatusEditResponse as StatusEditResponse -from .binding_create_params import BindingCreateParams as BindingCreateParams -from .binding_delete_response import BindingDeleteResponse as BindingDeleteResponse diff --git a/src/cloudflare/types/addressing/prefixes/bgp/bgp_prefix.py b/src/cloudflare/types/addressing/prefixes/bgp_prefix.py similarity index 96% rename from src/cloudflare/types/addressing/prefixes/bgp/bgp_prefix.py rename to src/cloudflare/types/addressing/prefixes/bgp_prefix.py index d9eecdf9d89..e58c9ebdd33 100644 --- a/src/cloudflare/types/addressing/prefixes/bgp/bgp_prefix.py +++ b/src/cloudflare/types/addressing/prefixes/bgp_prefix.py @@ -3,7 +3,7 @@ from typing import Optional from datetime import datetime -from ....._models import BaseModel +from ...._models import BaseModel __all__ = ["BGPPrefix", "BGPSignalOpts", "OnDemand"] @@ -50,7 +50,7 @@ class OnDemand(BaseModel): class BGPPrefix(BaseModel): id: Optional[str] = None - """Identifier""" + """Identifier of BGP Prefix.""" asn: Optional[int] = None """Autonomous System Number (ASN) the prefix will be advertised under.""" diff --git a/src/cloudflare/types/addressing/prefixes/bgp/binding_create_params.py b/src/cloudflare/types/addressing/prefixes/bgp_prefix_create_params.py similarity index 65% rename from src/cloudflare/types/addressing/prefixes/bgp/binding_create_params.py rename to src/cloudflare/types/addressing/prefixes/bgp_prefix_create_params.py index d4b3604ae77..387be0b879f 100644 --- a/src/cloudflare/types/addressing/prefixes/bgp/binding_create_params.py +++ b/src/cloudflare/types/addressing/prefixes/bgp_prefix_create_params.py @@ -4,15 +4,12 @@ from typing_extensions import Required, TypedDict -__all__ = ["BindingCreateParams"] +__all__ = ["BGPPrefixCreateParams"] -class BindingCreateParams(TypedDict, total=False): +class BGPPrefixCreateParams(TypedDict, total=False): account_id: Required[str] - """Identifier""" + """Identifier of a Cloudflare account.""" cidr: str """IP Prefix in Classless Inter-Domain Routing format.""" - - service_id: str - """Identifier""" diff --git a/src/cloudflare/types/addressing/prefixes/bgp/prefix_edit_params.py b/src/cloudflare/types/addressing/prefixes/bgp_prefix_edit_params.py similarity index 64% rename from src/cloudflare/types/addressing/prefixes/bgp/prefix_edit_params.py rename to src/cloudflare/types/addressing/prefixes/bgp_prefix_edit_params.py index 5040a427e1f..5822fc5a307 100644 --- a/src/cloudflare/types/addressing/prefixes/bgp/prefix_edit_params.py +++ b/src/cloudflare/types/addressing/prefixes/bgp_prefix_edit_params.py @@ -4,15 +4,15 @@ from typing_extensions import Required, TypedDict -__all__ = ["PrefixEditParams", "OnDemand"] +__all__ = ["BGPPrefixEditParams", "OnDemand"] -class PrefixEditParams(TypedDict, total=False): +class BGPPrefixEditParams(TypedDict, total=False): account_id: Required[str] - """Identifier""" + """Identifier of a Cloudflare account.""" prefix_id: Required[str] - """Identifier""" + """Identifier of an IP Prefix.""" on_demand: OnDemand diff --git a/src/cloudflare/types/addressing/prefixes/delegation_create_params.py b/src/cloudflare/types/addressing/prefixes/delegation_create_params.py index f8f9c9719f2..948fe969d3e 100644 --- a/src/cloudflare/types/addressing/prefixes/delegation_create_params.py +++ b/src/cloudflare/types/addressing/prefixes/delegation_create_params.py @@ -9,7 +9,7 @@ class DelegationCreateParams(TypedDict, total=False): account_id: Required[str] - """Identifier""" + """Identifier of a Cloudflare account.""" cidr: Required[str] """IP Prefix in Classless Inter-Domain Routing format.""" diff --git a/src/cloudflare/types/addressing/prefixes/delegation_delete_response.py b/src/cloudflare/types/addressing/prefixes/delegation_delete_response.py index 3581f2c3c0a..352868765b9 100644 --- a/src/cloudflare/types/addressing/prefixes/delegation_delete_response.py +++ b/src/cloudflare/types/addressing/prefixes/delegation_delete_response.py @@ -9,4 +9,4 @@ class DelegationDeleteResponse(BaseModel): id: Optional[str] = None - """Delegation identifier tag.""" + """Identifier of a Delegation.""" diff --git a/src/cloudflare/types/addressing/prefixes/delegations.py b/src/cloudflare/types/addressing/prefixes/delegations.py index 8a2d2d8fea8..c9b97dfc3d5 100644 --- a/src/cloudflare/types/addressing/prefixes/delegations.py +++ b/src/cloudflare/types/addressing/prefixes/delegations.py @@ -10,7 +10,7 @@ class Delegations(BaseModel): id: Optional[str] = None - """Delegation identifier tag.""" + """Identifier of a Delegation.""" cidr: Optional[str] = None """IP Prefix in Classless Inter-Domain Routing format.""" @@ -23,4 +23,4 @@ class Delegations(BaseModel): modified_at: Optional[datetime] = None parent_prefix_id: Optional[str] = None - """Identifier""" + """Identifier of an IP Prefix.""" diff --git a/src/cloudflare/types/addressing/prefixes/bgp/service_binding.py b/src/cloudflare/types/addressing/prefixes/service_binding.py similarity index 79% rename from src/cloudflare/types/addressing/prefixes/bgp/service_binding.py rename to src/cloudflare/types/addressing/prefixes/service_binding.py index 505f89b7c2e..34bbeabd065 100644 --- a/src/cloudflare/types/addressing/prefixes/bgp/service_binding.py +++ b/src/cloudflare/types/addressing/prefixes/service_binding.py @@ -3,7 +3,7 @@ from typing import Optional from typing_extensions import Literal -from ....._models import BaseModel +from ...._models import BaseModel __all__ = ["ServiceBinding", "Provisioning"] @@ -18,7 +18,7 @@ class Provisioning(BaseModel): class ServiceBinding(BaseModel): id: Optional[str] = None - """Identifier""" + """Identifier of a Service Binding.""" cidr: Optional[str] = None """IP Prefix in Classless Inter-Domain Routing format.""" @@ -27,7 +27,10 @@ class ServiceBinding(BaseModel): """Status of a Service Binding's deployment to the Cloudflare network""" service_id: Optional[str] = None - """Identifier""" + """Identifier of a Service on the Cloudflare network. + + Available services and their IDs may be found in the **List Services** endpoint. + """ service_name: Optional[str] = None """Name of a service running on the Cloudflare network""" diff --git a/src/cloudflare/types/addressing/prefixes/service_binding_create_params.py b/src/cloudflare/types/addressing/prefixes/service_binding_create_params.py new file mode 100644 index 00000000000..6e1f0420211 --- /dev/null +++ b/src/cloudflare/types/addressing/prefixes/service_binding_create_params.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ServiceBindingCreateParams"] + + +class ServiceBindingCreateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier of a Cloudflare account.""" + + cidr: str + """IP Prefix in Classless Inter-Domain Routing format.""" + + service_id: str + """Identifier of a Service on the Cloudflare network. + + Available services and their IDs may be found in the **List Services** endpoint. + """ diff --git a/src/cloudflare/types/addressing/prefixes/service_binding_delete_response.py b/src/cloudflare/types/addressing/prefixes/service_binding_delete_response.py new file mode 100644 index 00000000000..7c24a85fea7 --- /dev/null +++ b/src/cloudflare/types/addressing/prefixes/service_binding_delete_response.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import Literal + +from ...._models import BaseModel +from ...shared.response_info import ResponseInfo + +__all__ = ["ServiceBindingDeleteResponse"] + + +class ServiceBindingDeleteResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + success: Literal[True] + """Whether the API call was successful""" diff --git a/src/cloudflare/types/addressing/service_list_response.py b/src/cloudflare/types/addressing/service_list_response.py index e4e66040091..a97b11929a2 100644 --- a/src/cloudflare/types/addressing/service_list_response.py +++ b/src/cloudflare/types/addressing/service_list_response.py @@ -9,7 +9,10 @@ class ServiceListResponse(BaseModel): id: Optional[str] = None - """Identifier""" + """Identifier of a Service on the Cloudflare network. + + Available services and their IDs may be found in the **List Services** endpoint. + """ name: Optional[str] = None """Name of a service running on the Cloudflare network""" diff --git a/src/cloudflare/types/ai/__init__.py b/src/cloudflare/types/ai/__init__.py new file mode 100644 index 00000000000..4f495e50871 --- /dev/null +++ b/src/cloudflare/types/ai/__init__.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .ai_run_params import AIRunParams as AIRunParams +from .ai_run_response import AIRunResponse as AIRunResponse +from .model_list_params import ModelListParams as ModelListParams +from .finetune_create_params import FinetuneCreateParams as FinetuneCreateParams +from .finetune_list_response import FinetuneListResponse as FinetuneListResponse +from .finetune_create_response import FinetuneCreateResponse as FinetuneCreateResponse diff --git a/src/cloudflare/types/workers/ai_run_params.py b/src/cloudflare/types/ai/ai_run_params.py similarity index 100% rename from src/cloudflare/types/workers/ai_run_params.py rename to src/cloudflare/types/ai/ai_run_params.py diff --git a/src/cloudflare/types/workers/ai_run_response.py b/src/cloudflare/types/ai/ai_run_response.py similarity index 100% rename from src/cloudflare/types/workers/ai_run_response.py rename to src/cloudflare/types/ai/ai_run_response.py diff --git a/src/cloudflare/types/addressing/prefixes/bgp/status_edit_params.py b/src/cloudflare/types/ai/finetune_create_params.py similarity index 51% rename from src/cloudflare/types/addressing/prefixes/bgp/status_edit_params.py rename to src/cloudflare/types/ai/finetune_create_params.py index 10f8c1cf7b3..84fc0d24f14 100644 --- a/src/cloudflare/types/addressing/prefixes/bgp/status_edit_params.py +++ b/src/cloudflare/types/ai/finetune_create_params.py @@ -4,12 +4,16 @@ from typing_extensions import Required, TypedDict -__all__ = ["StatusEditParams"] +__all__ = ["FinetuneCreateParams"] -class StatusEditParams(TypedDict, total=False): +class FinetuneCreateParams(TypedDict, total=False): account_id: Required[str] - """Identifier""" - advertised: Required[bool] - """Enablement of prefix advertisement to the Internet.""" + model: Required[str] + + name: Required[str] + + description: str + + public: bool diff --git a/src/cloudflare/types/ai/finetune_create_response.py b/src/cloudflare/types/ai/finetune_create_response.py new file mode 100644 index 00000000000..2b4b9963389 --- /dev/null +++ b/src/cloudflare/types/ai/finetune_create_response.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["FinetuneCreateResponse"] + + +class FinetuneCreateResponse(BaseModel): + id: str + + created_at: datetime + + model: str + + modified_at: datetime + + name: str + + public: bool + + description: Optional[str] = None diff --git a/src/cloudflare/types/ai/finetune_list_response.py b/src/cloudflare/types/ai/finetune_list_response.py new file mode 100644 index 00000000000..b036b170114 --- /dev/null +++ b/src/cloudflare/types/ai/finetune_list_response.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["FinetuneListResponse"] + + +class FinetuneListResponse(BaseModel): + id: str + + created_at: datetime + + model: str + + modified_at: datetime + + name: str + + description: Optional[str] = None diff --git a/src/cloudflare/types/ai/finetunes/__init__.py b/src/cloudflare/types/ai/finetunes/__init__.py new file mode 100644 index 00000000000..736711396fa --- /dev/null +++ b/src/cloudflare/types/ai/finetunes/__init__.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .public_list_params import PublicListParams as PublicListParams +from .asset_create_params import AssetCreateParams as AssetCreateParams +from .public_list_response import PublicListResponse as PublicListResponse +from .asset_create_response import AssetCreateResponse as AssetCreateResponse diff --git a/src/cloudflare/types/ai/finetunes/asset_create_params.py b/src/cloudflare/types/ai/finetunes/asset_create_params.py new file mode 100644 index 00000000000..26f0da33305 --- /dev/null +++ b/src/cloudflare/types/ai/finetunes/asset_create_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from ...._types import FileTypes + +__all__ = ["AssetCreateParams"] + + +class AssetCreateParams(TypedDict, total=False): + account_id: Required[str] + + file: FileTypes + + file_name: str diff --git a/src/cloudflare/types/ai/finetunes/asset_create_response.py b/src/cloudflare/types/ai/finetunes/asset_create_response.py new file mode 100644 index 00000000000..eef3e2d7d2d --- /dev/null +++ b/src/cloudflare/types/ai/finetunes/asset_create_response.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["AssetCreateResponse"] + + +class AssetCreateResponse(BaseModel): + id: str + + bucket_name: str + + created_at: datetime + + file_name: str + + finetune_id: str + + modified_at: datetime diff --git a/src/cloudflare/types/ai/finetunes/public_list_params.py b/src/cloudflare/types/ai/finetunes/public_list_params.py new file mode 100644 index 00000000000..c5a973eaf63 --- /dev/null +++ b/src/cloudflare/types/ai/finetunes/public_list_params.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["PublicListParams"] + + +class PublicListParams(TypedDict, total=False): + account_id: Required[str] + + limit: float + """Pagination Limit""" + + offset: float + """Pagination Offset""" + + order_by: Annotated[str, PropertyInfo(alias="orderBy")] + """Order By Column Name""" diff --git a/src/cloudflare/types/ai/finetunes/public_list_response.py b/src/cloudflare/types/ai/finetunes/public_list_response.py new file mode 100644 index 00000000000..4f96442b435 --- /dev/null +++ b/src/cloudflare/types/ai/finetunes/public_list_response.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["PublicListResponse"] + + +class PublicListResponse(BaseModel): + id: str + + created_at: datetime + + model: str + + modified_at: datetime + + name: str + + public: bool + + description: Optional[str] = None diff --git a/src/cloudflare/types/ai/model_list_params.py b/src/cloudflare/types/ai/model_list_params.py new file mode 100644 index 00000000000..bcbc1d7bc05 --- /dev/null +++ b/src/cloudflare/types/ai/model_list_params.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ModelListParams"] + + +class ModelListParams(TypedDict, total=False): + account_id: Required[str] + + author: str + """Filter by Author""" + + hide_experimental: bool + """Filter to hide experimental models""" + + page: int + + per_page: int + + search: str + """Search""" + + source: float + """Filter by Source Id""" + + task: str + """Filter by Task Name""" diff --git a/src/cloudflare/types/workers/ai/models/__init__.py b/src/cloudflare/types/ai/models/__init__.py similarity index 100% rename from src/cloudflare/types/workers/ai/models/__init__.py rename to src/cloudflare/types/ai/models/__init__.py diff --git a/src/cloudflare/types/workers/ai/models/schema_get_params.py b/src/cloudflare/types/ai/models/schema_get_params.py similarity index 100% rename from src/cloudflare/types/workers/ai/models/schema_get_params.py rename to src/cloudflare/types/ai/models/schema_get_params.py diff --git a/src/cloudflare/types/ai_gateway/ai_gateway_create_response.py b/src/cloudflare/types/ai_gateway/ai_gateway_create_response.py index d13ca4fea1f..8c4df8ce75e 100644 --- a/src/cloudflare/types/ai_gateway/ai_gateway_create_response.py +++ b/src/cloudflare/types/ai_gateway/ai_gateway_create_response.py @@ -13,6 +13,10 @@ class AIGatewayCreateResponse(BaseModel): id: str """gateway id""" + account_id: str + + account_tag: str + cache_invalidate_on_update: bool cache_ttl: Optional[int] = None @@ -21,6 +25,8 @@ class AIGatewayCreateResponse(BaseModel): created_at: datetime + internal_id: str + modified_at: datetime rate_limiting_interval: Optional[int] = None diff --git a/src/cloudflare/types/ai_gateway/ai_gateway_delete_response.py b/src/cloudflare/types/ai_gateway/ai_gateway_delete_response.py index 96e4ed45b33..56b71b99466 100644 --- a/src/cloudflare/types/ai_gateway/ai_gateway_delete_response.py +++ b/src/cloudflare/types/ai_gateway/ai_gateway_delete_response.py @@ -13,6 +13,10 @@ class AIGatewayDeleteResponse(BaseModel): id: str """gateway id""" + account_id: str + + account_tag: str + cache_invalidate_on_update: bool cache_ttl: Optional[int] = None @@ -21,6 +25,8 @@ class AIGatewayDeleteResponse(BaseModel): created_at: datetime + internal_id: str + modified_at: datetime rate_limiting_interval: Optional[int] = None diff --git a/src/cloudflare/types/ai_gateway/ai_gateway_get_response.py b/src/cloudflare/types/ai_gateway/ai_gateway_get_response.py index 4686eb08c4f..eed84b4ee8d 100644 --- a/src/cloudflare/types/ai_gateway/ai_gateway_get_response.py +++ b/src/cloudflare/types/ai_gateway/ai_gateway_get_response.py @@ -13,6 +13,10 @@ class AIGatewayGetResponse(BaseModel): id: str """gateway id""" + account_id: str + + account_tag: str + cache_invalidate_on_update: bool cache_ttl: Optional[int] = None @@ -21,6 +25,8 @@ class AIGatewayGetResponse(BaseModel): created_at: datetime + internal_id: str + modified_at: datetime rate_limiting_interval: Optional[int] = None diff --git a/src/cloudflare/types/ai_gateway/ai_gateway_list_params.py b/src/cloudflare/types/ai_gateway/ai_gateway_list_params.py index a363b567a3f..a2545d4af8e 100644 --- a/src/cloudflare/types/ai_gateway/ai_gateway_list_params.py +++ b/src/cloudflare/types/ai_gateway/ai_gateway_list_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict __all__ = ["AIGatewayListParams"] @@ -10,12 +10,6 @@ class AIGatewayListParams(TypedDict, total=False): account_id: Required[str] - order_by: str - """Order By Column Name""" - - order_by_direction: Literal["asc", "desc"] - """Order By Direction""" - page: int per_page: int diff --git a/src/cloudflare/types/ai_gateway/ai_gateway_list_response.py b/src/cloudflare/types/ai_gateway/ai_gateway_list_response.py index b7e93763d69..31dca9345f4 100644 --- a/src/cloudflare/types/ai_gateway/ai_gateway_list_response.py +++ b/src/cloudflare/types/ai_gateway/ai_gateway_list_response.py @@ -13,6 +13,10 @@ class AIGatewayListResponse(BaseModel): id: str """gateway id""" + account_id: str + + account_tag: str + cache_invalidate_on_update: bool cache_ttl: Optional[int] = None @@ -21,6 +25,8 @@ class AIGatewayListResponse(BaseModel): created_at: datetime + internal_id: str + modified_at: datetime rate_limiting_interval: Optional[int] = None diff --git a/src/cloudflare/types/ai_gateway/ai_gateway_update_response.py b/src/cloudflare/types/ai_gateway/ai_gateway_update_response.py index 9a0077bb441..21e6cd223b6 100644 --- a/src/cloudflare/types/ai_gateway/ai_gateway_update_response.py +++ b/src/cloudflare/types/ai_gateway/ai_gateway_update_response.py @@ -13,6 +13,10 @@ class AIGatewayUpdateResponse(BaseModel): id: str """gateway id""" + account_id: str + + account_tag: str + cache_invalidate_on_update: bool cache_ttl: Optional[int] = None @@ -21,6 +25,8 @@ class AIGatewayUpdateResponse(BaseModel): created_at: datetime + internal_id: str + modified_at: datetime rate_limiting_interval: Optional[int] = None diff --git a/src/cloudflare/types/ai_gateway/dataset_create_response.py b/src/cloudflare/types/ai_gateway/dataset_create_response.py index 806584ab12e..5be90be4a14 100644 --- a/src/cloudflare/types/ai_gateway/dataset_create_response.py +++ b/src/cloudflare/types/ai_gateway/dataset_create_response.py @@ -34,6 +34,10 @@ class Filter(BaseModel): class DatasetCreateResponse(BaseModel): id: str + account_id: str + + account_tag: str + created_at: datetime enable: bool diff --git a/src/cloudflare/types/ai_gateway/dataset_delete_response.py b/src/cloudflare/types/ai_gateway/dataset_delete_response.py index b097128ba3c..9b9ede756f2 100644 --- a/src/cloudflare/types/ai_gateway/dataset_delete_response.py +++ b/src/cloudflare/types/ai_gateway/dataset_delete_response.py @@ -34,6 +34,10 @@ class Filter(BaseModel): class DatasetDeleteResponse(BaseModel): id: str + account_id: str + + account_tag: str + created_at: datetime enable: bool diff --git a/src/cloudflare/types/ai_gateway/dataset_get_response.py b/src/cloudflare/types/ai_gateway/dataset_get_response.py index 1641c723f9e..102c0cd1b49 100644 --- a/src/cloudflare/types/ai_gateway/dataset_get_response.py +++ b/src/cloudflare/types/ai_gateway/dataset_get_response.py @@ -34,6 +34,10 @@ class Filter(BaseModel): class DatasetGetResponse(BaseModel): id: str + account_id: str + + account_tag: str + created_at: datetime enable: bool diff --git a/src/cloudflare/types/ai_gateway/dataset_list_params.py b/src/cloudflare/types/ai_gateway/dataset_list_params.py index 29c35578d00..440331fa032 100644 --- a/src/cloudflare/types/ai_gateway/dataset_list_params.py +++ b/src/cloudflare/types/ai_gateway/dataset_list_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict __all__ = ["DatasetListParams"] @@ -14,12 +14,6 @@ class DatasetListParams(TypedDict, total=False): name: str - order_by: str - """Order By Column Name""" - - order_by_direction: Literal["asc", "desc"] - """Order By Direction""" - page: int per_page: int diff --git a/src/cloudflare/types/ai_gateway/dataset_list_response.py b/src/cloudflare/types/ai_gateway/dataset_list_response.py index 710a48b322d..cf9d6e28bd3 100644 --- a/src/cloudflare/types/ai_gateway/dataset_list_response.py +++ b/src/cloudflare/types/ai_gateway/dataset_list_response.py @@ -34,6 +34,10 @@ class Filter(BaseModel): class DatasetListResponse(BaseModel): id: str + account_id: str + + account_tag: str + created_at: datetime enable: bool diff --git a/src/cloudflare/types/ai_gateway/dataset_update_response.py b/src/cloudflare/types/ai_gateway/dataset_update_response.py index a68021d1647..2cfeca9e20c 100644 --- a/src/cloudflare/types/ai_gateway/dataset_update_response.py +++ b/src/cloudflare/types/ai_gateway/dataset_update_response.py @@ -34,6 +34,10 @@ class Filter(BaseModel): class DatasetUpdateResponse(BaseModel): id: str + account_id: str + + account_tag: str + created_at: datetime enable: bool diff --git a/src/cloudflare/types/ai_gateway/evaluation_create_response.py b/src/cloudflare/types/ai_gateway/evaluation_create_response.py index 41775aef604..40b1b09254b 100644 --- a/src/cloudflare/types/ai_gateway/evaluation_create_response.py +++ b/src/cloudflare/types/ai_gateway/evaluation_create_response.py @@ -34,6 +34,10 @@ class DatasetFilter(BaseModel): class Dataset(BaseModel): id: str + account_id: str + + account_tag: str + created_at: datetime enable: bool @@ -71,6 +75,10 @@ class Result(BaseModel): class EvaluationCreateResponse(BaseModel): id: str + account_id: str + + account_tag: str + created_at: datetime datasets: List[Dataset] diff --git a/src/cloudflare/types/ai_gateway/evaluation_delete_response.py b/src/cloudflare/types/ai_gateway/evaluation_delete_response.py index 97255d29893..163d4406dd6 100644 --- a/src/cloudflare/types/ai_gateway/evaluation_delete_response.py +++ b/src/cloudflare/types/ai_gateway/evaluation_delete_response.py @@ -34,6 +34,10 @@ class DatasetFilter(BaseModel): class Dataset(BaseModel): id: str + account_id: str + + account_tag: str + created_at: datetime enable: bool @@ -71,6 +75,10 @@ class Result(BaseModel): class EvaluationDeleteResponse(BaseModel): id: str + account_id: str + + account_tag: str + created_at: datetime datasets: List[Dataset] diff --git a/src/cloudflare/types/ai_gateway/evaluation_get_response.py b/src/cloudflare/types/ai_gateway/evaluation_get_response.py index 63b8598ce32..2ac71bd4a18 100644 --- a/src/cloudflare/types/ai_gateway/evaluation_get_response.py +++ b/src/cloudflare/types/ai_gateway/evaluation_get_response.py @@ -34,6 +34,10 @@ class DatasetFilter(BaseModel): class Dataset(BaseModel): id: str + account_id: str + + account_tag: str + created_at: datetime enable: bool @@ -71,6 +75,10 @@ class Result(BaseModel): class EvaluationGetResponse(BaseModel): id: str + account_id: str + + account_tag: str + created_at: datetime datasets: List[Dataset] diff --git a/src/cloudflare/types/ai_gateway/evaluation_list_params.py b/src/cloudflare/types/ai_gateway/evaluation_list_params.py index 1577eb25188..deefec45cbf 100644 --- a/src/cloudflare/types/ai_gateway/evaluation_list_params.py +++ b/src/cloudflare/types/ai_gateway/evaluation_list_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict __all__ = ["EvaluationListParams"] @@ -12,12 +12,6 @@ class EvaluationListParams(TypedDict, total=False): name: str - order_by: str - """Order By Column Name""" - - order_by_direction: Literal["asc", "desc"] - """Order By Direction""" - page: int per_page: int diff --git a/src/cloudflare/types/ai_gateway/evaluation_list_response.py b/src/cloudflare/types/ai_gateway/evaluation_list_response.py index 75a55183881..e40b09a38aa 100644 --- a/src/cloudflare/types/ai_gateway/evaluation_list_response.py +++ b/src/cloudflare/types/ai_gateway/evaluation_list_response.py @@ -34,6 +34,10 @@ class DatasetFilter(BaseModel): class Dataset(BaseModel): id: str + account_id: str + + account_tag: str + created_at: datetime enable: bool @@ -71,6 +75,10 @@ class Result(BaseModel): class EvaluationListResponse(BaseModel): id: str + account_id: str + + account_tag: str + created_at: datetime datasets: List[Dataset] diff --git a/src/cloudflare/types/ai_gateway/log_delete_params.py b/src/cloudflare/types/ai_gateway/log_delete_params.py index 4a6d76f27a0..0f7f4ca6c3c 100644 --- a/src/cloudflare/types/ai_gateway/log_delete_params.py +++ b/src/cloudflare/types/ai_gateway/log_delete_params.py @@ -35,6 +35,7 @@ class LogDeleteParams(TypedDict, total=False): class Filter(TypedDict, total=False): key: Required[ Literal[ + "id", "created_at", "request_content_type", "response_content_type", @@ -49,6 +50,12 @@ class Filter(TypedDict, total=False): "tokens_out", "duration", "feedback", + "event_id", + "request_type", + "metadata.key", + "metadata.value", + "prompts.prompt_id", + "prompts.version_id", ] ] diff --git a/src/cloudflare/types/ai_gateway/log_list_params.py b/src/cloudflare/types/ai_gateway/log_list_params.py index 14365d3a489..dbdf158649c 100644 --- a/src/cloudflare/types/ai_gateway/log_list_params.py +++ b/src/cloudflare/types/ai_gateway/log_list_params.py @@ -74,6 +74,7 @@ class LogListParams(TypedDict, total=False): class Filter(TypedDict, total=False): key: Required[ Literal[ + "id", "created_at", "request_content_type", "response_content_type", @@ -88,6 +89,12 @@ class Filter(TypedDict, total=False): "tokens_out", "duration", "feedback", + "event_id", + "request_type", + "metadata.key", + "metadata.value", + "prompts.prompt_id", + "prompts.version_id", ] ] diff --git a/src/cloudflare/types/api_gateway/__init__.py b/src/cloudflare/types/api_gateway/__init__.py index 272e71c2b78..bb1373799ba 100644 --- a/src/cloudflare/types/api_gateway/__init__.py +++ b/src/cloudflare/types/api_gateway/__init__.py @@ -4,7 +4,6 @@ from .message import Message as Message from .settings import Settings as Settings -from .api_shield import APIShield as APIShield from .configuration import Configuration as Configuration from .public_schema import PublicSchema as PublicSchema from .schema_upload import SchemaUpload as SchemaUpload @@ -26,5 +25,7 @@ from .user_schema_create_params import UserSchemaCreateParams as UserSchemaCreateParams from .configuration_update_params import ConfigurationUpdateParams as ConfigurationUpdateParams from .user_schema_delete_response import UserSchemaDeleteResponse as UserSchemaDeleteResponse +from .operation_bulk_create_params import OperationBulkCreateParams as OperationBulkCreateParams from .configuration_update_response import ConfigurationUpdateResponse as ConfigurationUpdateResponse +from .operation_bulk_create_response import OperationBulkCreateResponse as OperationBulkCreateResponse from .operation_bulk_delete_response import OperationBulkDeleteResponse as OperationBulkDeleteResponse diff --git a/src/cloudflare/types/api_gateway/api_shield.py b/src/cloudflare/types/api_gateway/api_shield.py deleted file mode 100644 index f884d96b96c..00000000000 --- a/src/cloudflare/types/api_gateway/api_shield.py +++ /dev/null @@ -1,227 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from ..._models import BaseModel - -__all__ = [ - "APIShield", - "Features", - "FeaturesAPIShieldOperationFeatureThresholds", - "FeaturesAPIShieldOperationFeatureThresholdsThresholds", - "FeaturesAPIShieldOperationFeatureParameterSchemas", - "FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas", - "FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas", - "FeaturesAPIShieldOperationFeatureAPIRouting", - "FeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting", - "FeaturesAPIShieldOperationFeatureConfidenceIntervals", - "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals", - "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold", - "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals", - "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90", - "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95", - "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99", - "FeaturesAPIShieldOperationFeatureSchemaInfo", - "FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo", - "FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema", -] - - -class FeaturesAPIShieldOperationFeatureThresholdsThresholds(BaseModel): - auth_id_tokens: Optional[int] = None - """The total number of auth-ids seen across this calculation.""" - - data_points: Optional[int] = None - """The number of data points used for the threshold suggestion calculation.""" - - last_updated: Optional[datetime] = None - - p50: Optional[int] = None - """The p50 quantile of requests (in period_seconds).""" - - p90: Optional[int] = None - """The p90 quantile of requests (in period_seconds).""" - - p99: Optional[int] = None - """The p99 quantile of requests (in period_seconds).""" - - period_seconds: Optional[int] = None - """The period over which this threshold is suggested.""" - - requests: Optional[int] = None - """The estimated number of requests covered by these calculations.""" - - suggested_threshold: Optional[int] = None - """The suggested threshold in requests done by the same auth_id or period_seconds.""" - - -class FeaturesAPIShieldOperationFeatureThresholds(BaseModel): - thresholds: Optional[FeaturesAPIShieldOperationFeatureThresholdsThresholds] = None - - -class FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas(BaseModel): - parameters: Optional[List[object]] = None - """An array containing the learned parameter schemas.""" - - responses: Optional[object] = None - """An empty response object. - - This field is required to yield a valid operation schema. - """ - - -class FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas(BaseModel): - last_updated: Optional[datetime] = None - - parameter_schemas: Optional[FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas] = ( - None - ) - """An operation schema object containing a response.""" - - -class FeaturesAPIShieldOperationFeatureParameterSchemas(BaseModel): - parameter_schemas: FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas - - -class FeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting(BaseModel): - last_updated: Optional[datetime] = None - - route: Optional[str] = None - """Target route.""" - - -class FeaturesAPIShieldOperationFeatureAPIRouting(BaseModel): - api_routing: Optional[FeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting] = None - """API Routing settings on endpoint.""" - - -class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90( - BaseModel -): - lower: Optional[float] = None - """Lower bound for percentile estimate""" - - upper: Optional[float] = None - """Upper bound for percentile estimate""" - - -class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95( - BaseModel -): - lower: Optional[float] = None - """Lower bound for percentile estimate""" - - upper: Optional[float] = None - """Upper bound for percentile estimate""" - - -class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99( - BaseModel -): - lower: Optional[float] = None - """Lower bound for percentile estimate""" - - upper: Optional[float] = None - """Upper bound for percentile estimate""" - - -class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals( - BaseModel -): - p90: Optional[ - FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90 - ] = None - """Upper and lower bound for percentile estimate""" - - p95: Optional[ - FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95 - ] = None - """Upper and lower bound for percentile estimate""" - - p99: Optional[ - FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99 - ] = None - """Upper and lower bound for percentile estimate""" - - -class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold(BaseModel): - confidence_intervals: Optional[ - FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals - ] = None - - mean: Optional[float] = None - """Suggested threshold.""" - - -class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals(BaseModel): - last_updated: Optional[datetime] = None - - suggested_threshold: Optional[ - FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold - ] = None - - -class FeaturesAPIShieldOperationFeatureConfidenceIntervals(BaseModel): - confidence_intervals: Optional[FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals] = None - - -class FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema(BaseModel): - id: Optional[str] = None - """UUID""" - - created_at: Optional[datetime] = None - - is_learned: Optional[bool] = None - """True if schema is Cloudflare-provided.""" - - name: Optional[str] = None - """Schema file name.""" - - -class FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo(BaseModel): - active_schema: Optional[FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema] = None - """Schema active on endpoint.""" - - learned_available: Optional[bool] = None - """True if a Cloudflare-provided learned schema is available for this endpoint.""" - - mitigation_action: Optional[Literal["none", "log", "block"]] = None - """Action taken on requests failing validation.""" - - -class FeaturesAPIShieldOperationFeatureSchemaInfo(BaseModel): - schema_info: Optional[FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo] = None - - -Features: TypeAlias = Union[ - FeaturesAPIShieldOperationFeatureThresholds, - FeaturesAPIShieldOperationFeatureParameterSchemas, - FeaturesAPIShieldOperationFeatureAPIRouting, - FeaturesAPIShieldOperationFeatureConfidenceIntervals, - FeaturesAPIShieldOperationFeatureSchemaInfo, -] - - -class APIShield(BaseModel): - endpoint: str - """ - The endpoint which can contain path parameter templates in curly braces, each - will be replaced from left to right with {varN}, starting with {var1}, during - insertion. This will further be Cloudflare-normalized upon insertion. See: - https://developers.cloudflare.com/rules/normalization/how-it-works/. - """ - - host: str - """RFC3986-compliant host.""" - - last_updated: datetime - - method: Literal["GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "CONNECT", "PATCH", "TRACE"] - """The HTTP method used to access the endpoint.""" - - operation_id: str - """UUID""" - - features: Optional[Features] = None diff --git a/src/cloudflare/types/api_gateway/operation_bulk_create_params.py b/src/cloudflare/types/api_gateway/operation_bulk_create_params.py new file mode 100644 index 00000000000..8672ae972e9 --- /dev/null +++ b/src/cloudflare/types/api_gateway/operation_bulk_create_params.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["OperationBulkCreateParams", "Body"] + + +class OperationBulkCreateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[Iterable[Body]] + + +class Body(TypedDict, total=False): + endpoint: Required[str] + """ + The endpoint which can contain path parameter templates in curly braces, each + will be replaced from left to right with {varN}, starting with {var1}, during + insertion. This will further be Cloudflare-normalized upon insertion. See: + https://developers.cloudflare.com/rules/normalization/how-it-works/. + """ + + host: Required[str] + """RFC3986-compliant host.""" + + method: Required[Literal["GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "CONNECT", "PATCH", "TRACE"]] + """The HTTP method used to access the endpoint.""" diff --git a/src/cloudflare/types/api_gateway/operation_bulk_create_response.py b/src/cloudflare/types/api_gateway/operation_bulk_create_response.py new file mode 100644 index 00000000000..cf7c4824a17 --- /dev/null +++ b/src/cloudflare/types/api_gateway/operation_bulk_create_response.py @@ -0,0 +1,239 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from datetime import datetime +from typing_extensions import Literal, TypeAlias + +from ..._models import BaseModel + +__all__ = [ + "OperationBulkCreateResponse", + "OperationBulkCreateResponseItem", + "OperationBulkCreateResponseItemFeatures", + "OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureThresholds", + "OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureThresholdsThresholds", + "OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureParameterSchemas", + "OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas", + "OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas", + "OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureAPIRouting", + "OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting", + "OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervals", + "OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals", + "OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold", + "OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals", + "OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90", + "OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95", + "OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99", + "OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureSchemaInfo", + "OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo", + "OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema", +] + + +class OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureThresholdsThresholds(BaseModel): + auth_id_tokens: Optional[int] = None + """The total number of auth-ids seen across this calculation.""" + + data_points: Optional[int] = None + """The number of data points used for the threshold suggestion calculation.""" + + last_updated: Optional[datetime] = None + + p50: Optional[int] = None + """The p50 quantile of requests (in period_seconds).""" + + p90: Optional[int] = None + """The p90 quantile of requests (in period_seconds).""" + + p99: Optional[int] = None + """The p99 quantile of requests (in period_seconds).""" + + period_seconds: Optional[int] = None + """The period over which this threshold is suggested.""" + + requests: Optional[int] = None + """The estimated number of requests covered by these calculations.""" + + suggested_threshold: Optional[int] = None + """The suggested threshold in requests done by the same auth_id or period_seconds.""" + + +class OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureThresholds(BaseModel): + thresholds: Optional[OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureThresholdsThresholds] = None + + +class OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas( + BaseModel +): + parameters: Optional[List[object]] = None + """An array containing the learned parameter schemas.""" + + responses: Optional[object] = None + """An empty response object. + + This field is required to yield a valid operation schema. + """ + + +class OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas(BaseModel): + last_updated: Optional[datetime] = None + + parameter_schemas: Optional[ + OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas + ] = None + """An operation schema object containing a response.""" + + +class OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureParameterSchemas(BaseModel): + parameter_schemas: OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas + + +class OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting(BaseModel): + last_updated: Optional[datetime] = None + + route: Optional[str] = None + """Target route.""" + + +class OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureAPIRouting(BaseModel): + api_routing: Optional[OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting] = None + """API Routing settings on endpoint.""" + + +class OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90( + BaseModel +): + lower: Optional[float] = None + """Lower bound for percentile estimate""" + + upper: Optional[float] = None + """Upper bound for percentile estimate""" + + +class OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95( + BaseModel +): + lower: Optional[float] = None + """Lower bound for percentile estimate""" + + upper: Optional[float] = None + """Upper bound for percentile estimate""" + + +class OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99( + BaseModel +): + lower: Optional[float] = None + """Lower bound for percentile estimate""" + + upper: Optional[float] = None + """Upper bound for percentile estimate""" + + +class OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals( + BaseModel +): + p90: Optional[ + OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90 + ] = None + """Upper and lower bound for percentile estimate""" + + p95: Optional[ + OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95 + ] = None + """Upper and lower bound for percentile estimate""" + + p99: Optional[ + OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99 + ] = None + """Upper and lower bound for percentile estimate""" + + +class OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold( + BaseModel +): + confidence_intervals: Optional[ + OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals + ] = None + + mean: Optional[float] = None + """Suggested threshold.""" + + +class OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals(BaseModel): + last_updated: Optional[datetime] = None + + suggested_threshold: Optional[ + OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold + ] = None + + +class OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervals(BaseModel): + confidence_intervals: Optional[ + OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals + ] = None + + +class OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema(BaseModel): + id: Optional[str] = None + """UUID""" + + created_at: Optional[datetime] = None + + is_learned: Optional[bool] = None + """True if schema is Cloudflare-provided.""" + + name: Optional[str] = None + """Schema file name.""" + + +class OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo(BaseModel): + active_schema: Optional[ + OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema + ] = None + """Schema active on endpoint.""" + + learned_available: Optional[bool] = None + """True if a Cloudflare-provided learned schema is available for this endpoint.""" + + mitigation_action: Optional[Literal["none", "log", "block"]] = None + """Action taken on requests failing validation.""" + + +class OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureSchemaInfo(BaseModel): + schema_info: Optional[OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo] = None + + +OperationBulkCreateResponseItemFeatures: TypeAlias = Union[ + OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureThresholds, + OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureParameterSchemas, + OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureAPIRouting, + OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureConfidenceIntervals, + OperationBulkCreateResponseItemFeaturesAPIShieldOperationFeatureSchemaInfo, +] + + +class OperationBulkCreateResponseItem(BaseModel): + endpoint: str + """ + The endpoint which can contain path parameter templates in curly braces, each + will be replaced from left to right with {varN}, starting with {var1}, during + insertion. This will further be Cloudflare-normalized upon insertion. See: + https://developers.cloudflare.com/rules/normalization/how-it-works/. + """ + + host: str + """RFC3986-compliant host.""" + + last_updated: datetime + + method: Literal["GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "CONNECT", "PATCH", "TRACE"] + """The HTTP method used to access the endpoint.""" + + operation_id: str + """UUID""" + + features: Optional[OperationBulkCreateResponseItemFeatures] = None + + +OperationBulkCreateResponse: TypeAlias = List[OperationBulkCreateResponseItem] diff --git a/src/cloudflare/types/api_gateway/operation_create_params.py b/src/cloudflare/types/api_gateway/operation_create_params.py index dbfa97bf6e8..4563a0f9afb 100644 --- a/src/cloudflare/types/api_gateway/operation_create_params.py +++ b/src/cloudflare/types/api_gateway/operation_create_params.py @@ -2,20 +2,15 @@ from __future__ import annotations -from typing import Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["OperationCreateParams", "Body"] +__all__ = ["OperationCreateParams"] class OperationCreateParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - body: Required[Iterable[Body]] - - -class Body(TypedDict, total=False): endpoint: Required[str] """ The endpoint which can contain path parameter templates in curly braces, each diff --git a/src/cloudflare/types/api_gateway/operation_create_response.py b/src/cloudflare/types/api_gateway/operation_create_response.py index 23d0751ec12..a9b73ff2a91 100644 --- a/src/cloudflare/types/api_gateway/operation_create_response.py +++ b/src/cloudflare/types/api_gateway/operation_create_response.py @@ -1,10 +1,227 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List -from typing_extensions import TypeAlias +from typing import List, Union, Optional +from datetime import datetime +from typing_extensions import Literal, TypeAlias -from .api_shield import APIShield +from ..._models import BaseModel -__all__ = ["OperationCreateResponse"] +__all__ = [ + "OperationCreateResponse", + "Features", + "FeaturesAPIShieldOperationFeatureThresholds", + "FeaturesAPIShieldOperationFeatureThresholdsThresholds", + "FeaturesAPIShieldOperationFeatureParameterSchemas", + "FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas", + "FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas", + "FeaturesAPIShieldOperationFeatureAPIRouting", + "FeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting", + "FeaturesAPIShieldOperationFeatureConfidenceIntervals", + "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals", + "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold", + "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals", + "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90", + "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95", + "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99", + "FeaturesAPIShieldOperationFeatureSchemaInfo", + "FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo", + "FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema", +] -OperationCreateResponse: TypeAlias = List[APIShield] + +class FeaturesAPIShieldOperationFeatureThresholdsThresholds(BaseModel): + auth_id_tokens: Optional[int] = None + """The total number of auth-ids seen across this calculation.""" + + data_points: Optional[int] = None + """The number of data points used for the threshold suggestion calculation.""" + + last_updated: Optional[datetime] = None + + p50: Optional[int] = None + """The p50 quantile of requests (in period_seconds).""" + + p90: Optional[int] = None + """The p90 quantile of requests (in period_seconds).""" + + p99: Optional[int] = None + """The p99 quantile of requests (in period_seconds).""" + + period_seconds: Optional[int] = None + """The period over which this threshold is suggested.""" + + requests: Optional[int] = None + """The estimated number of requests covered by these calculations.""" + + suggested_threshold: Optional[int] = None + """The suggested threshold in requests done by the same auth_id or period_seconds.""" + + +class FeaturesAPIShieldOperationFeatureThresholds(BaseModel): + thresholds: Optional[FeaturesAPIShieldOperationFeatureThresholdsThresholds] = None + + +class FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas(BaseModel): + parameters: Optional[List[object]] = None + """An array containing the learned parameter schemas.""" + + responses: Optional[object] = None + """An empty response object. + + This field is required to yield a valid operation schema. + """ + + +class FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas(BaseModel): + last_updated: Optional[datetime] = None + + parameter_schemas: Optional[FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas] = ( + None + ) + """An operation schema object containing a response.""" + + +class FeaturesAPIShieldOperationFeatureParameterSchemas(BaseModel): + parameter_schemas: FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas + + +class FeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting(BaseModel): + last_updated: Optional[datetime] = None + + route: Optional[str] = None + """Target route.""" + + +class FeaturesAPIShieldOperationFeatureAPIRouting(BaseModel): + api_routing: Optional[FeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting] = None + """API Routing settings on endpoint.""" + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90( + BaseModel +): + lower: Optional[float] = None + """Lower bound for percentile estimate""" + + upper: Optional[float] = None + """Upper bound for percentile estimate""" + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95( + BaseModel +): + lower: Optional[float] = None + """Lower bound for percentile estimate""" + + upper: Optional[float] = None + """Upper bound for percentile estimate""" + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99( + BaseModel +): + lower: Optional[float] = None + """Lower bound for percentile estimate""" + + upper: Optional[float] = None + """Upper bound for percentile estimate""" + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals( + BaseModel +): + p90: Optional[ + FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90 + ] = None + """Upper and lower bound for percentile estimate""" + + p95: Optional[ + FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95 + ] = None + """Upper and lower bound for percentile estimate""" + + p99: Optional[ + FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99 + ] = None + """Upper and lower bound for percentile estimate""" + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold(BaseModel): + confidence_intervals: Optional[ + FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals + ] = None + + mean: Optional[float] = None + """Suggested threshold.""" + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals(BaseModel): + last_updated: Optional[datetime] = None + + suggested_threshold: Optional[ + FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold + ] = None + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervals(BaseModel): + confidence_intervals: Optional[FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals] = None + + +class FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema(BaseModel): + id: Optional[str] = None + """UUID""" + + created_at: Optional[datetime] = None + + is_learned: Optional[bool] = None + """True if schema is Cloudflare-provided.""" + + name: Optional[str] = None + """Schema file name.""" + + +class FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo(BaseModel): + active_schema: Optional[FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema] = None + """Schema active on endpoint.""" + + learned_available: Optional[bool] = None + """True if a Cloudflare-provided learned schema is available for this endpoint.""" + + mitigation_action: Optional[Literal["none", "log", "block"]] = None + """Action taken on requests failing validation.""" + + +class FeaturesAPIShieldOperationFeatureSchemaInfo(BaseModel): + schema_info: Optional[FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo] = None + + +Features: TypeAlias = Union[ + FeaturesAPIShieldOperationFeatureThresholds, + FeaturesAPIShieldOperationFeatureParameterSchemas, + FeaturesAPIShieldOperationFeatureAPIRouting, + FeaturesAPIShieldOperationFeatureConfidenceIntervals, + FeaturesAPIShieldOperationFeatureSchemaInfo, +] + + +class OperationCreateResponse(BaseModel): + endpoint: str + """ + The endpoint which can contain path parameter templates in curly braces, each + will be replaced from left to right with {varN}, starting with {var1}, during + insertion. This will further be Cloudflare-normalized upon insertion. See: + https://developers.cloudflare.com/rules/normalization/how-it-works/. + """ + + host: str + """RFC3986-compliant host.""" + + last_updated: datetime + + method: Literal["GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "CONNECT", "PATCH", "TRACE"] + """The HTTP method used to access the endpoint.""" + + operation_id: str + """UUID""" + + features: Optional[Features] = None diff --git a/src/cloudflare/types/api_gateway/user_schemas/operation_list_response.py b/src/cloudflare/types/api_gateway/user_schemas/operation_list_response.py index 3149155c055..cae8a5a0a92 100644 --- a/src/cloudflare/types/api_gateway/user_schemas/operation_list_response.py +++ b/src/cloudflare/types/api_gateway/user_schemas/operation_list_response.py @@ -1,12 +1,236 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import List, Union, Optional +from datetime import datetime from typing_extensions import Literal, TypeAlias from ...._models import BaseModel -from ..api_shield import APIShield -__all__ = ["OperationListResponse", "APIShieldBasicOperation"] +__all__ = [ + "OperationListResponse", + "APIShieldOperation", + "APIShieldOperationFeatures", + "APIShieldOperationFeaturesAPIShieldOperationFeatureThresholds", + "APIShieldOperationFeaturesAPIShieldOperationFeatureThresholdsThresholds", + "APIShieldOperationFeaturesAPIShieldOperationFeatureParameterSchemas", + "APIShieldOperationFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas", + "APIShieldOperationFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas", + "APIShieldOperationFeaturesAPIShieldOperationFeatureAPIRouting", + "APIShieldOperationFeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting", + "APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervals", + "APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals", + "APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold", + "APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals", + "APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90", + "APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95", + "APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99", + "APIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfo", + "APIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo", + "APIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema", + "APIShieldBasicOperation", +] + + +class APIShieldOperationFeaturesAPIShieldOperationFeatureThresholdsThresholds(BaseModel): + auth_id_tokens: Optional[int] = None + """The total number of auth-ids seen across this calculation.""" + + data_points: Optional[int] = None + """The number of data points used for the threshold suggestion calculation.""" + + last_updated: Optional[datetime] = None + + p50: Optional[int] = None + """The p50 quantile of requests (in period_seconds).""" + + p90: Optional[int] = None + """The p90 quantile of requests (in period_seconds).""" + + p99: Optional[int] = None + """The p99 quantile of requests (in period_seconds).""" + + period_seconds: Optional[int] = None + """The period over which this threshold is suggested.""" + + requests: Optional[int] = None + """The estimated number of requests covered by these calculations.""" + + suggested_threshold: Optional[int] = None + """The suggested threshold in requests done by the same auth_id or period_seconds.""" + + +class APIShieldOperationFeaturesAPIShieldOperationFeatureThresholds(BaseModel): + thresholds: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureThresholdsThresholds] = None + + +class APIShieldOperationFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas(BaseModel): + parameters: Optional[List[object]] = None + """An array containing the learned parameter schemas.""" + + responses: Optional[object] = None + """An empty response object. + + This field is required to yield a valid operation schema. + """ + + +class APIShieldOperationFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas(BaseModel): + last_updated: Optional[datetime] = None + + parameter_schemas: Optional[ + APIShieldOperationFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas + ] = None + """An operation schema object containing a response.""" + + +class APIShieldOperationFeaturesAPIShieldOperationFeatureParameterSchemas(BaseModel): + parameter_schemas: APIShieldOperationFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas + + +class APIShieldOperationFeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting(BaseModel): + last_updated: Optional[datetime] = None + + route: Optional[str] = None + """Target route.""" + + +class APIShieldOperationFeaturesAPIShieldOperationFeatureAPIRouting(BaseModel): + api_routing: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting] = None + """API Routing settings on endpoint.""" + + +class APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90( + BaseModel +): + lower: Optional[float] = None + """Lower bound for percentile estimate""" + + upper: Optional[float] = None + """Upper bound for percentile estimate""" + + +class APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95( + BaseModel +): + lower: Optional[float] = None + """Lower bound for percentile estimate""" + + upper: Optional[float] = None + """Upper bound for percentile estimate""" + + +class APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99( + BaseModel +): + lower: Optional[float] = None + """Lower bound for percentile estimate""" + + upper: Optional[float] = None + """Upper bound for percentile estimate""" + + +class APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals( + BaseModel +): + p90: Optional[ + APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90 + ] = None + """Upper and lower bound for percentile estimate""" + + p95: Optional[ + APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95 + ] = None + """Upper and lower bound for percentile estimate""" + + p99: Optional[ + APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99 + ] = None + """Upper and lower bound for percentile estimate""" + + +class APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold( + BaseModel +): + confidence_intervals: Optional[ + APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals + ] = None + + mean: Optional[float] = None + """Suggested threshold.""" + + +class APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals(BaseModel): + last_updated: Optional[datetime] = None + + suggested_threshold: Optional[ + APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold + ] = None + + +class APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervals(BaseModel): + confidence_intervals: Optional[ + APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals + ] = None + + +class APIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema(BaseModel): + id: Optional[str] = None + """UUID""" + + created_at: Optional[datetime] = None + + is_learned: Optional[bool] = None + """True if schema is Cloudflare-provided.""" + + name: Optional[str] = None + """Schema file name.""" + + +class APIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo(BaseModel): + active_schema: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema] = None + """Schema active on endpoint.""" + + learned_available: Optional[bool] = None + """True if a Cloudflare-provided learned schema is available for this endpoint.""" + + mitigation_action: Optional[Literal["none", "log", "block"]] = None + """Action taken on requests failing validation.""" + + +class APIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfo(BaseModel): + schema_info: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo] = None + + +APIShieldOperationFeatures: TypeAlias = Union[ + APIShieldOperationFeaturesAPIShieldOperationFeatureThresholds, + APIShieldOperationFeaturesAPIShieldOperationFeatureParameterSchemas, + APIShieldOperationFeaturesAPIShieldOperationFeatureAPIRouting, + APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervals, + APIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfo, +] + + +class APIShieldOperation(BaseModel): + endpoint: str + """ + The endpoint which can contain path parameter templates in curly braces, each + will be replaced from left to right with {varN}, starting with {var1}, during + insertion. This will further be Cloudflare-normalized upon insertion. See: + https://developers.cloudflare.com/rules/normalization/how-it-works/. + """ + + host: str + """RFC3986-compliant host.""" + + last_updated: datetime + + method: Literal["GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "CONNECT", "PATCH", "TRACE"] + """The HTTP method used to access the endpoint.""" + + operation_id: str + """UUID""" + + features: Optional[APIShieldOperationFeatures] = None class APIShieldBasicOperation(BaseModel): @@ -25,4 +249,4 @@ class APIShieldBasicOperation(BaseModel): """The HTTP method used to access the endpoint.""" -OperationListResponse: TypeAlias = Union[APIShield, APIShieldBasicOperation] +OperationListResponse: TypeAlias = Union[APIShieldOperation, APIShieldBasicOperation] diff --git a/src/cloudflare/types/argo/tiered_caching_edit_response.py b/src/cloudflare/types/argo/tiered_caching_edit_response.py index 0e99559b8f5..dfabfbc67c2 100644 --- a/src/cloudflare/types/argo/tiered_caching_edit_response.py +++ b/src/cloudflare/types/argo/tiered_caching_edit_response.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional from datetime import datetime from typing_extensions import Literal @@ -9,14 +10,14 @@ class TieredCachingEditResponse(BaseModel): - id: str - """The identifier of the caching setting""" + id: Literal["tiered_caching"] + """ID of the zone setting.""" editable: bool """Whether the setting is editable""" - modified_on: datetime - """The time when the setting was last modified""" - value: Literal["on", "off"] - """The status of the feature being on / off""" + """The value of the feature""" + + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/argo/tiered_caching_get_response.py b/src/cloudflare/types/argo/tiered_caching_get_response.py index 72f04aac880..8747f72e833 100644 --- a/src/cloudflare/types/argo/tiered_caching_get_response.py +++ b/src/cloudflare/types/argo/tiered_caching_get_response.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional from datetime import datetime from typing_extensions import Literal @@ -9,14 +10,14 @@ class TieredCachingGetResponse(BaseModel): - id: str - """The identifier of the caching setting""" + id: Literal["tiered_caching"] + """ID of the zone setting.""" editable: bool """Whether the setting is editable""" - modified_on: datetime - """The time when the setting was last modified""" - value: Literal["on", "off"] - """The status of the feature being on / off""" + """The value of the feature""" + + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/__init__.py b/src/cloudflare/types/cache/__init__.py index dca49dade79..10937a5c1b3 100644 --- a/src/cloudflare/types/cache/__init__.py +++ b/src/cloudflare/types/cache/__init__.py @@ -4,7 +4,6 @@ from .state import State as State from .cache_reserve import CacheReserve as CacheReserve -from .cache_variant import CacheVariant as CacheVariant from .cache_purge_params import CachePurgeParams as CachePurgeParams from .cache_reserve_clear import CacheReserveClear as CacheReserveClear from .variant_edit_params import VariantEditParams as VariantEditParams @@ -12,6 +11,7 @@ from .variant_get_response import VariantGetResponse as VariantGetResponse from .regional_tiered_cache import RegionalTieredCache as RegionalTieredCache from .variant_edit_response import VariantEditResponse as VariantEditResponse +from .variant_delete_response import VariantDeleteResponse as VariantDeleteResponse from .cache_reserve_edit_params import CacheReserveEditParams as CacheReserveEditParams from .cache_reserve_clear_params import CacheReserveClearParams as CacheReserveClearParams from .cache_reserve_get_response import CacheReserveGetResponse as CacheReserveGetResponse diff --git a/src/cloudflare/types/cache/cache_reserve_clear_response.py b/src/cloudflare/types/cache/cache_reserve_clear_response.py index 6ef83d88029..48410c41b3c 100644 --- a/src/cloudflare/types/cache/cache_reserve_clear_response.py +++ b/src/cloudflare/types/cache/cache_reserve_clear_response.py @@ -14,9 +14,6 @@ class CacheReserveClearResponse(BaseModel): id: CacheReserveClear """ID of the zone setting.""" - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - start_ts: datetime """The time that the latest Cache Reserve Clear operation started.""" @@ -25,3 +22,6 @@ class CacheReserveClearResponse(BaseModel): end_ts: Optional[datetime] = None """The time that the latest Cache Reserve Clear operation completed.""" + + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/cache_reserve_edit_response.py b/src/cloudflare/types/cache/cache_reserve_edit_response.py index cf94dab2551..1ecbfb5cc66 100644 --- a/src/cloudflare/types/cache/cache_reserve_edit_response.py +++ b/src/cloudflare/types/cache/cache_reserve_edit_response.py @@ -14,8 +14,11 @@ class CacheReserveEditResponse(BaseModel): id: CacheReserve """ID of the zone setting.""" - modified_on: Optional[datetime] = None - """last time this setting was modified.""" + editable: bool + """Whether the setting is editable""" value: Literal["on", "off"] - """Value of the Cache Reserve zone setting.""" + """The value of the feature""" + + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/cache_reserve_get_response.py b/src/cloudflare/types/cache/cache_reserve_get_response.py index 78ddefe3883..bfca4dcc125 100644 --- a/src/cloudflare/types/cache/cache_reserve_get_response.py +++ b/src/cloudflare/types/cache/cache_reserve_get_response.py @@ -14,8 +14,11 @@ class CacheReserveGetResponse(BaseModel): id: CacheReserve """ID of the zone setting.""" - modified_on: Optional[datetime] = None - """last time this setting was modified.""" + editable: bool + """Whether the setting is editable""" value: Literal["on", "off"] - """Value of the Cache Reserve zone setting.""" + """The value of the feature""" + + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/cache_reserve_status_response.py b/src/cloudflare/types/cache/cache_reserve_status_response.py index abc1c4cba82..277b898dd11 100644 --- a/src/cloudflare/types/cache/cache_reserve_status_response.py +++ b/src/cloudflare/types/cache/cache_reserve_status_response.py @@ -14,9 +14,6 @@ class CacheReserveStatusResponse(BaseModel): id: CacheReserveClear """ID of the zone setting.""" - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - start_ts: datetime """The time that the latest Cache Reserve Clear operation started.""" @@ -25,3 +22,6 @@ class CacheReserveStatusResponse(BaseModel): end_ts: Optional[datetime] = None """The time that the latest Cache Reserve Clear operation completed.""" + + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/regional_tiered_cache_edit_response.py b/src/cloudflare/types/cache/regional_tiered_cache_edit_response.py index 8350d75dc86..089ee489e99 100644 --- a/src/cloudflare/types/cache/regional_tiered_cache_edit_response.py +++ b/src/cloudflare/types/cache/regional_tiered_cache_edit_response.py @@ -2,31 +2,23 @@ from typing import Optional from datetime import datetime +from typing_extensions import Literal from ..._models import BaseModel from .regional_tiered_cache import RegionalTieredCache -__all__ = ["RegionalTieredCacheEditResponse", "Value"] +__all__ = ["RegionalTieredCacheEditResponse"] -class Value(BaseModel): +class RegionalTieredCacheEditResponse(BaseModel): id: RegionalTieredCache """ID of the zone setting.""" - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - + editable: bool + """Whether the setting is editable""" -class RegionalTieredCacheEditResponse(BaseModel): - id: RegionalTieredCache - """ID of the zone setting.""" + value: Literal["on", "off"] + """The value of the feature""" modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - value: Value - """ - Instructs Cloudflare to check a regional hub data center on the way to your - upper tier. This can help improve performance for smart and custom tiered cache - topologies. - """ + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/regional_tiered_cache_get_response.py b/src/cloudflare/types/cache/regional_tiered_cache_get_response.py index ac3f6c4e6e3..2730910de20 100644 --- a/src/cloudflare/types/cache/regional_tiered_cache_get_response.py +++ b/src/cloudflare/types/cache/regional_tiered_cache_get_response.py @@ -2,31 +2,23 @@ from typing import Optional from datetime import datetime +from typing_extensions import Literal from ..._models import BaseModel from .regional_tiered_cache import RegionalTieredCache -__all__ = ["RegionalTieredCacheGetResponse", "Value"] +__all__ = ["RegionalTieredCacheGetResponse"] -class Value(BaseModel): +class RegionalTieredCacheGetResponse(BaseModel): id: RegionalTieredCache """ID of the zone setting.""" - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - + editable: bool + """Whether the setting is editable""" -class RegionalTieredCacheGetResponse(BaseModel): - id: RegionalTieredCache - """ID of the zone setting.""" + value: Literal["on", "off"] + """The value of the feature""" modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - value: Value - """ - Instructs Cloudflare to check a regional hub data center on the way to your - upper tier. This can help improve performance for smart and custom tiered cache - topologies. - """ + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/smart_tiered_cache_delete_response.py b/src/cloudflare/types/cache/smart_tiered_cache_delete_response.py index 3ccc2711f88..7bc174f36ae 100644 --- a/src/cloudflare/types/cache/smart_tiered_cache_delete_response.py +++ b/src/cloudflare/types/cache/smart_tiered_cache_delete_response.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional from datetime import datetime from typing_extensions import Literal @@ -9,14 +10,11 @@ class SmartTieredCacheDeleteResponse(BaseModel): - id: str - """The identifier of the caching setting""" + id: Literal["tiered_cache_smart_topology_enable"] + """ID of the zone setting.""" editable: bool """Whether the setting is editable""" - modified_on: datetime - """The time when the setting was last modified""" - - value: Literal["on", "off"] - """The status of the feature being on / off""" + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/smart_tiered_cache_edit_response.py b/src/cloudflare/types/cache/smart_tiered_cache_edit_response.py index 8e871b0599c..75ab468d3bb 100644 --- a/src/cloudflare/types/cache/smart_tiered_cache_edit_response.py +++ b/src/cloudflare/types/cache/smart_tiered_cache_edit_response.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional from datetime import datetime from typing_extensions import Literal @@ -9,14 +10,14 @@ class SmartTieredCacheEditResponse(BaseModel): - id: str - """The identifier of the caching setting""" + id: Literal["tiered_cache_smart_topology_enable"] + """ID of the zone setting.""" editable: bool """Whether the setting is editable""" - modified_on: datetime - """The time when the setting was last modified""" - value: Literal["on", "off"] - """The status of the feature being on / off""" + """The value of the feature""" + + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/smart_tiered_cache_get_response.py b/src/cloudflare/types/cache/smart_tiered_cache_get_response.py index 787aa0d5d59..b8066e94776 100644 --- a/src/cloudflare/types/cache/smart_tiered_cache_get_response.py +++ b/src/cloudflare/types/cache/smart_tiered_cache_get_response.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional from datetime import datetime from typing_extensions import Literal @@ -9,14 +10,14 @@ class SmartTieredCacheGetResponse(BaseModel): - id: str - """The identifier of the caching setting""" + id: Literal["tiered_cache_smart_topology_enable"] + """ID of the zone setting.""" editable: bool """Whether the setting is editable""" - modified_on: datetime - """The time when the setting was last modified""" - value: Literal["on", "off"] - """The status of the feature being on / off""" + """The value of the feature""" + + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/cache_variant.py b/src/cloudflare/types/cache/variant_delete_response.py similarity index 63% rename from src/cloudflare/types/cache/cache_variant.py rename to src/cloudflare/types/cache/variant_delete_response.py index e83ec666d1c..6d697bb1232 100644 --- a/src/cloudflare/types/cache/cache_variant.py +++ b/src/cloudflare/types/cache/variant_delete_response.py @@ -6,12 +6,15 @@ from ..._models import BaseModel -__all__ = ["CacheVariant"] +__all__ = ["VariantDeleteResponse"] -class CacheVariant(BaseModel): +class VariantDeleteResponse(BaseModel): id: Literal["variants"] """ID of the zone setting.""" + editable: bool + """Whether the setting is editable""" + modified_on: Optional[datetime] = None - """last time this setting was modified.""" + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/variant_edit_response.py b/src/cloudflare/types/cache/variant_edit_response.py index bdd337a206e..0cd828d795a 100644 --- a/src/cloudflare/types/cache/variant_edit_response.py +++ b/src/cloudflare/types/cache/variant_edit_response.py @@ -1,88 +1,23 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel -__all__ = ["VariantEditResponse", "Value"] - - -class Value(BaseModel): - avif: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for avif. - """ - - bmp: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for bmp. - """ - - gif: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for gif. - """ - - jp2: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for jp2. - """ - - jpeg: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for jpeg. - """ - - jpg: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for jpg. - """ - - jpg2: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for jpg2. - """ - - png: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for png. - """ - - tif: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for tif. - """ - - tiff: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for tiff. - """ - - webp: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for webp. - """ +__all__ = ["VariantEditResponse"] class VariantEditResponse(BaseModel): id: Literal["variants"] """ID of the zone setting.""" - modified_on: Optional[datetime] = None - """last time this setting was modified.""" + editable: bool + """Whether the setting is editable""" + + value: str + """The value of the feature""" - value: Value - """Value of the zone setting.""" + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/variant_get_response.py b/src/cloudflare/types/cache/variant_get_response.py index 777c7d0da5c..1b440b5b812 100644 --- a/src/cloudflare/types/cache/variant_get_response.py +++ b/src/cloudflare/types/cache/variant_get_response.py @@ -1,88 +1,23 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel -__all__ = ["VariantGetResponse", "Value"] - - -class Value(BaseModel): - avif: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for avif. - """ - - bmp: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for bmp. - """ - - gif: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for gif. - """ - - jp2: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for jp2. - """ - - jpeg: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for jpeg. - """ - - jpg: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for jpg. - """ - - jpg2: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for jpg2. - """ - - png: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for png. - """ - - tif: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for tif. - """ - - tiff: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for tiff. - """ - - webp: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for webp. - """ +__all__ = ["VariantGetResponse"] class VariantGetResponse(BaseModel): id: Literal["variants"] """ID of the zone setting.""" - modified_on: Optional[datetime] = None - """last time this setting was modified.""" + editable: bool + """Whether the setting is editable""" + + value: str + """The value of the feature""" - value: Value - """Value of the zone setting.""" + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cloud_connector/rule_update_params.py b/src/cloudflare/types/cloud_connector/rule_update_params.py index f8c25c9b2a7..41d4e4aaa74 100644 --- a/src/cloudflare/types/cloud_connector/rule_update_params.py +++ b/src/cloudflare/types/cloud_connector/rule_update_params.py @@ -5,23 +5,23 @@ from typing import Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["RuleUpdateParams", "Body", "BodyParameters"] +__all__ = ["RuleUpdateParams", "Rule", "RuleParameters"] class RuleUpdateParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - body: Required[Iterable[Body]] + rules: Required[Iterable[Rule]] """List of Cloud Connector rules""" -class BodyParameters(TypedDict, total=False): +class RuleParameters(TypedDict, total=False): host: str """Host to perform Cloud Connection to""" -class Body(TypedDict, total=False): +class Rule(TypedDict, total=False): id: str description: str @@ -30,7 +30,7 @@ class Body(TypedDict, total=False): expression: str - parameters: BodyParameters + parameters: RuleParameters """Parameters of Cloud Connector Rule""" provider: Literal["aws_s3", "r2", "gcp_storage", "azure_storage"] diff --git a/src/cloudflare/types/dns/__init__.py b/src/cloudflare/types/dns/__init__.py index 896ce3f6c10..13c7472b8f1 100644 --- a/src/cloudflare/types/dns/__init__.py +++ b/src/cloudflare/types/dns/__init__.py @@ -28,9 +28,11 @@ from .dnskey_record import DNSKEYRecord as DNSKEYRecord from .smimea_record import SMIMEARecord as SMIMEARecord from .a_record_param import ARecordParam as ARecordParam +from .batch_put_param import BatchPutParam as BatchPutParam from .ds_record_param import DSRecordParam as DSRecordParam from .mx_record_param import MXRecordParam as MXRecordParam from .ns_record_param import NSRecordParam as NSRecordParam +from .record_response import RecordResponse as RecordResponse from .caa_record_param import CAARecordParam as CAARecordParam from .loc_record_param import LOCRecordParam as LOCRecordParam from .ptr_record_param import PTRRecordParam as PTRRecordParam @@ -38,6 +40,7 @@ from .txt_record_param import TXTRecordParam as TXTRecordParam from .uri_record_param import URIRecordParam as URIRecordParam from .aaaa_record_param import AAAARecordParam as AAAARecordParam +from .batch_patch_param import BatchPatchParam as BatchPatchParam from .cert_record_param import CERTRecordParam as CERTRecordParam from .svcb_record_param import SVCBRecordParam as SVCBRecordParam from .tlsa_record_param import TLSARecordParam as TLSARecordParam @@ -52,23 +55,17 @@ from .dns_analytics_query import DNSAnalyticsQuery as DNSAnalyticsQuery from .dnskey_record_param import DNSKEYRecordParam as DNSKEYRecordParam from .record_batch_params import RecordBatchParams as RecordBatchParams -from .record_get_response import RecordGetResponse as RecordGetResponse from .setting_edit_params import SettingEditParams as SettingEditParams from .smimea_record_param import SMIMEARecordParam as SMIMEARecordParam from .record_create_params import RecordCreateParams as RecordCreateParams -from .record_edit_response import RecordEditResponse as RecordEditResponse from .record_import_params import RecordImportParams as RecordImportParams -from .record_list_response import RecordListResponse as RecordListResponse from .record_scan_response import RecordScanResponse as RecordScanResponse from .record_update_params import RecordUpdateParams as RecordUpdateParams from .setting_get_response import SettingGetResponse as SettingGetResponse from .record_batch_response import RecordBatchResponse as RecordBatchResponse -from .record_process_timing import RecordProcessTiming as RecordProcessTiming from .setting_edit_response import SettingEditResponse as SettingEditResponse from .dnssec_delete_response import DNSSECDeleteResponse as DNSSECDeleteResponse -from .record_create_response import RecordCreateResponse as RecordCreateResponse from .record_delete_response import RecordDeleteResponse as RecordDeleteResponse from .record_export_response import RecordExportResponse as RecordExportResponse from .record_import_response import RecordImportResponse as RecordImportResponse -from .record_update_response import RecordUpdateResponse as RecordUpdateResponse from .dns_analytics_nominal_metric import DNSAnalyticsNominalMetric as DNSAnalyticsNominalMetric diff --git a/src/cloudflare/types/dns/a_record.py b/src/cloudflare/types/dns/a_record.py index 0e92b18aa87..45e3bc709a2 100644 --- a/src/cloudflare/types/dns/a_record.py +++ b/src/cloudflare/types/dns/a_record.py @@ -7,7 +7,25 @@ from ..._models import BaseModel from .record_tags import RecordTags -__all__ = ["ARecord"] +__all__ = ["ARecord", "Settings"] + + +class Settings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ class ARecord(BaseModel): @@ -29,6 +47,9 @@ class ARecord(BaseModel): Cloudflare. """ + settings: Optional[Settings] = None + """Settings for the DNS record.""" + tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/a_record_param.py b/src/cloudflare/types/dns/a_record_param.py index a7b46b5a982..181939fa954 100644 --- a/src/cloudflare/types/dns/a_record_param.py +++ b/src/cloudflare/types/dns/a_record_param.py @@ -8,7 +8,25 @@ from .ttl_param import TTLParam from .record_tags import RecordTags -__all__ = ["ARecordParam"] +__all__ = ["ARecordParam", "Settings"] + + +class Settings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ class ARecordParam(TypedDict, total=False): @@ -30,6 +48,9 @@ class ARecordParam(TypedDict, total=False): Cloudflare. """ + settings: Settings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/aaaa_record.py b/src/cloudflare/types/dns/aaaa_record.py index 12b4a80d50f..a9b929e4f9f 100644 --- a/src/cloudflare/types/dns/aaaa_record.py +++ b/src/cloudflare/types/dns/aaaa_record.py @@ -7,7 +7,25 @@ from ..._models import BaseModel from .record_tags import RecordTags -__all__ = ["AAAARecord"] +__all__ = ["AAAARecord", "Settings"] + + +class Settings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ class AAAARecord(BaseModel): @@ -29,6 +47,9 @@ class AAAARecord(BaseModel): Cloudflare. """ + settings: Optional[Settings] = None + """Settings for the DNS record.""" + tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/aaaa_record_param.py b/src/cloudflare/types/dns/aaaa_record_param.py index dda366f6e09..d305b76b8f0 100644 --- a/src/cloudflare/types/dns/aaaa_record_param.py +++ b/src/cloudflare/types/dns/aaaa_record_param.py @@ -8,7 +8,25 @@ from .ttl_param import TTLParam from .record_tags import RecordTags -__all__ = ["AAAARecordParam"] +__all__ = ["AAAARecordParam", "Settings"] + + +class Settings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ class AAAARecordParam(TypedDict, total=False): @@ -30,6 +48,9 @@ class AAAARecordParam(TypedDict, total=False): Cloudflare. """ + settings: Settings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/batch_patch_param.py b/src/cloudflare/types/dns/batch_patch_param.py new file mode 100644 index 00000000000..e3e0ae92005 --- /dev/null +++ b/src/cloudflare/types/dns/batch_patch_param.py @@ -0,0 +1,237 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .ttl_param import TTLParam +from .record_tags import RecordTags +from .a_record_param import ARecordParam +from .ds_record_param import DSRecordParam +from .mx_record_param import MXRecordParam +from .ns_record_param import NSRecordParam +from .caa_record_param import CAARecordParam +from .loc_record_param import LOCRecordParam +from .ptr_record_param import PTRRecordParam +from .srv_record_param import SRVRecordParam +from .txt_record_param import TXTRecordParam +from .uri_record_param import URIRecordParam +from .aaaa_record_param import AAAARecordParam +from .cert_record_param import CERTRecordParam +from .svcb_record_param import SVCBRecordParam +from .tlsa_record_param import TLSARecordParam +from .cname_record_param import CNAMERecordParam +from .https_record_param import HTTPSRecordParam +from .naptr_record_param import NAPTRRecordParam +from .sshfp_record_param import SSHFPRecordParam +from .dnskey_record_param import DNSKEYRecordParam +from .smimea_record_param import SMIMEARecordParam + +__all__ = [ + "BatchPatchParam", + "ARecord", + "AAAARecord", + "CAARecord", + "CERTRecord", + "CNAMERecord", + "DNSKEYRecord", + "DSRecord", + "HTTPSRecord", + "LOCRecord", + "MXRecord", + "NAPTRRecord", + "NSRecord", + "Openpgpkey", + "OpenpgpkeySettings", + "PTRRecord", + "SMIMEARecord", + "SRVRecord", + "SSHFPRecord", + "SVCBRecord", + "TLSARecord", + "TXTRecord", + "URIRecord", +] + + +class ARecord(ARecordParam): + id: Required[str] + """Identifier""" + + +class AAAARecord(AAAARecordParam): + id: Required[str] + """Identifier""" + + +class CAARecord(CAARecordParam): + id: Required[str] + """Identifier""" + + +class CERTRecord(CERTRecordParam): + id: Required[str] + """Identifier""" + + +class CNAMERecord(CNAMERecordParam): + id: Required[str] + """Identifier""" + + +class DNSKEYRecord(DNSKEYRecordParam): + id: Required[str] + """Identifier""" + + +class DSRecord(DSRecordParam): + id: Required[str] + """Identifier""" + + +class HTTPSRecord(HTTPSRecordParam): + id: Required[str] + """Identifier""" + + +class LOCRecord(LOCRecordParam): + id: Required[str] + """Identifier""" + + +class MXRecord(MXRecordParam): + id: Required[str] + """Identifier""" + + +class NAPTRRecord(NAPTRRecordParam): + id: Required[str] + """Identifier""" + + +class NSRecord(NSRecordParam): + id: Required[str] + """Identifier""" + + +class OpenpgpkeySettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + +class Openpgpkey(TypedDict, total=False): + id: Required[str] + """Identifier""" + + comment: str + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + content: str + """A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1)""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + proxied: bool + """ + Whether the record is receiving the performance and security benefits of + Cloudflare. + """ + + settings: OpenpgpkeySettings + """Settings for the DNS record.""" + + tags: List[RecordTags] + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: TTLParam + """Time To Live (TTL) of the DNS record in seconds. + + Setting to 1 means 'automatic'. Value must be between 60 and 86400, with the + minimum reduced to 30 for Enterprise zones. + """ + + type: Literal["OPENPGPKEY"] + """Record type.""" + + +class PTRRecord(PTRRecordParam): + id: Required[str] + """Identifier""" + + +class SMIMEARecord(SMIMEARecordParam): + id: Required[str] + """Identifier""" + + +class SRVRecord(SRVRecordParam): + id: Required[str] + """Identifier""" + + +class SSHFPRecord(SSHFPRecordParam): + id: Required[str] + """Identifier""" + + +class SVCBRecord(SVCBRecordParam): + id: Required[str] + """Identifier""" + + +class TLSARecord(TLSARecordParam): + id: Required[str] + """Identifier""" + + +class TXTRecord(TXTRecordParam): + id: Required[str] + """Identifier""" + + +class URIRecord(URIRecordParam): + id: Required[str] + """Identifier""" + + +BatchPatchParam: TypeAlias = Union[ + ARecord, + AAAARecord, + CAARecord, + CERTRecord, + CNAMERecord, + DNSKEYRecord, + DSRecord, + HTTPSRecord, + LOCRecord, + MXRecord, + NAPTRRecord, + NSRecord, + Openpgpkey, + PTRRecord, + SMIMEARecord, + SRVRecord, + SSHFPRecord, + SVCBRecord, + TLSARecord, + TXTRecord, + URIRecord, +] diff --git a/src/cloudflare/types/dns/batch_put_param.py b/src/cloudflare/types/dns/batch_put_param.py new file mode 100644 index 00000000000..d21c25d5b4c --- /dev/null +++ b/src/cloudflare/types/dns/batch_put_param.py @@ -0,0 +1,237 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .ttl_param import TTLParam +from .record_tags import RecordTags +from .a_record_param import ARecordParam +from .ds_record_param import DSRecordParam +from .mx_record_param import MXRecordParam +from .ns_record_param import NSRecordParam +from .caa_record_param import CAARecordParam +from .loc_record_param import LOCRecordParam +from .ptr_record_param import PTRRecordParam +from .srv_record_param import SRVRecordParam +from .txt_record_param import TXTRecordParam +from .uri_record_param import URIRecordParam +from .aaaa_record_param import AAAARecordParam +from .cert_record_param import CERTRecordParam +from .svcb_record_param import SVCBRecordParam +from .tlsa_record_param import TLSARecordParam +from .cname_record_param import CNAMERecordParam +from .https_record_param import HTTPSRecordParam +from .naptr_record_param import NAPTRRecordParam +from .sshfp_record_param import SSHFPRecordParam +from .dnskey_record_param import DNSKEYRecordParam +from .smimea_record_param import SMIMEARecordParam + +__all__ = [ + "BatchPutParam", + "ARecord", + "AAAARecord", + "CAARecord", + "CERTRecord", + "CNAMERecord", + "DNSKEYRecord", + "DSRecord", + "HTTPSRecord", + "LOCRecord", + "MXRecord", + "NAPTRRecord", + "NSRecord", + "Openpgpkey", + "OpenpgpkeySettings", + "PTRRecord", + "SMIMEARecord", + "SRVRecord", + "SSHFPRecord", + "SVCBRecord", + "TLSARecord", + "TXTRecord", + "URIRecord", +] + + +class ARecord(ARecordParam): + id: str + """Identifier""" + + +class AAAARecord(AAAARecordParam): + id: str + """Identifier""" + + +class CAARecord(CAARecordParam): + id: str + """Identifier""" + + +class CERTRecord(CERTRecordParam): + id: str + """Identifier""" + + +class CNAMERecord(CNAMERecordParam): + id: str + """Identifier""" + + +class DNSKEYRecord(DNSKEYRecordParam): + id: str + """Identifier""" + + +class DSRecord(DSRecordParam): + id: str + """Identifier""" + + +class HTTPSRecord(HTTPSRecordParam): + id: str + """Identifier""" + + +class LOCRecord(LOCRecordParam): + id: str + """Identifier""" + + +class MXRecord(MXRecordParam): + id: str + """Identifier""" + + +class NAPTRRecord(NAPTRRecordParam): + id: str + """Identifier""" + + +class NSRecord(NSRecordParam): + id: str + """Identifier""" + + +class OpenpgpkeySettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + +class Openpgpkey(TypedDict, total=False): + content: Required[str] + """A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1)""" + + name: Required[str] + """DNS record name (or @ for the zone apex) in Punycode.""" + + type: Required[Literal["OPENPGPKEY"]] + """Record type.""" + + id: str + """Identifier""" + + comment: str + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + proxied: bool + """ + Whether the record is receiving the performance and security benefits of + Cloudflare. + """ + + settings: OpenpgpkeySettings + """Settings for the DNS record.""" + + tags: List[RecordTags] + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: TTLParam + """Time To Live (TTL) of the DNS record in seconds. + + Setting to 1 means 'automatic'. Value must be between 60 and 86400, with the + minimum reduced to 30 for Enterprise zones. + """ + + +class PTRRecord(PTRRecordParam): + id: str + """Identifier""" + + +class SMIMEARecord(SMIMEARecordParam): + id: str + """Identifier""" + + +class SRVRecord(SRVRecordParam): + id: str + """Identifier""" + + +class SSHFPRecord(SSHFPRecordParam): + id: str + """Identifier""" + + +class SVCBRecord(SVCBRecordParam): + id: str + """Identifier""" + + +class TLSARecord(TLSARecordParam): + id: str + """Identifier""" + + +class TXTRecord(TXTRecordParam): + id: str + """Identifier""" + + +class URIRecord(URIRecordParam): + id: str + """Identifier""" + + +BatchPutParam: TypeAlias = Union[ + ARecord, + AAAARecord, + CAARecord, + CERTRecord, + CNAMERecord, + DNSKEYRecord, + DSRecord, + HTTPSRecord, + LOCRecord, + MXRecord, + NAPTRRecord, + NSRecord, + Openpgpkey, + PTRRecord, + SMIMEARecord, + SRVRecord, + SSHFPRecord, + SVCBRecord, + TLSARecord, + TXTRecord, + URIRecord, +] diff --git a/src/cloudflare/types/dns/caa_record.py b/src/cloudflare/types/dns/caa_record.py index db52be5fb3d..c4635a7d010 100644 --- a/src/cloudflare/types/dns/caa_record.py +++ b/src/cloudflare/types/dns/caa_record.py @@ -7,7 +7,7 @@ from ..._models import BaseModel from .record_tags import RecordTags -__all__ = ["CAARecord", "Data"] +__all__ = ["CAARecord", "Data", "Settings"] class Data(BaseModel): @@ -21,6 +21,24 @@ class Data(BaseModel): """Value of the record. This field's semantics depend on the chosen tag.""" +class Settings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class CAARecord(BaseModel): comment: Optional[str] = None """Comments or notes about the DNS record. @@ -43,6 +61,9 @@ class CAARecord(BaseModel): Cloudflare. """ + settings: Optional[Settings] = None + """Settings for the DNS record.""" + tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/caa_record_param.py b/src/cloudflare/types/dns/caa_record_param.py index f4607bff8a3..b33a737dcfd 100644 --- a/src/cloudflare/types/dns/caa_record_param.py +++ b/src/cloudflare/types/dns/caa_record_param.py @@ -8,7 +8,7 @@ from .ttl_param import TTLParam from .record_tags import RecordTags -__all__ = ["CAARecordParam", "Data"] +__all__ = ["CAARecordParam", "Data", "Settings"] class Data(TypedDict, total=False): @@ -22,6 +22,24 @@ class Data(TypedDict, total=False): """Value of the record. This field's semantics depend on the chosen tag.""" +class Settings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class CAARecordParam(TypedDict, total=False): comment: str """Comments or notes about the DNS record. @@ -41,6 +59,9 @@ class CAARecordParam(TypedDict, total=False): Cloudflare. """ + settings: Settings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/cert_record.py b/src/cloudflare/types/dns/cert_record.py index 773fc039929..158b93608aa 100644 --- a/src/cloudflare/types/dns/cert_record.py +++ b/src/cloudflare/types/dns/cert_record.py @@ -7,7 +7,7 @@ from ..._models import BaseModel from .record_tags import RecordTags -__all__ = ["CERTRecord", "Data"] +__all__ = ["CERTRecord", "Data", "Settings"] class Data(BaseModel): @@ -24,6 +24,24 @@ class Data(BaseModel): """Type.""" +class Settings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class CERTRecord(BaseModel): comment: Optional[str] = None """Comments or notes about the DNS record. @@ -46,6 +64,9 @@ class CERTRecord(BaseModel): Cloudflare. """ + settings: Optional[Settings] = None + """Settings for the DNS record.""" + tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/cert_record_param.py b/src/cloudflare/types/dns/cert_record_param.py index ae6a63bf15f..139c4c13d84 100644 --- a/src/cloudflare/types/dns/cert_record_param.py +++ b/src/cloudflare/types/dns/cert_record_param.py @@ -8,7 +8,7 @@ from .ttl_param import TTLParam from .record_tags import RecordTags -__all__ = ["CERTRecordParam", "Data"] +__all__ = ["CERTRecordParam", "Data", "Settings"] class Data(TypedDict, total=False): @@ -25,6 +25,24 @@ class Data(TypedDict, total=False): """Type.""" +class Settings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class CERTRecordParam(TypedDict, total=False): comment: str """Comments or notes about the DNS record. @@ -44,6 +62,9 @@ class CERTRecordParam(TypedDict, total=False): Cloudflare. """ + settings: Settings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/cname_record.py b/src/cloudflare/types/dns/cname_record.py index fb32c1ca384..acbb165c725 100644 --- a/src/cloudflare/types/dns/cname_record.py +++ b/src/cloudflare/types/dns/cname_record.py @@ -15,10 +15,26 @@ class Settings(BaseModel): """ If enabled, causes the CNAME record to be resolved externally and the resulting address records (e.g., A and AAAA) to be returned instead of the CNAME record - itself. This setting has no effect on proxied records, which are always + itself. This setting is unavailable for proxied records, since they are always flattened. """ + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + class CNAMERecord(BaseModel): comment: Optional[str] = None @@ -40,6 +56,7 @@ class CNAMERecord(BaseModel): """ settings: Optional[Settings] = None + """Settings for the DNS record.""" tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/cname_record_param.py b/src/cloudflare/types/dns/cname_record_param.py index 87006d1b36d..122daccc16c 100644 --- a/src/cloudflare/types/dns/cname_record_param.py +++ b/src/cloudflare/types/dns/cname_record_param.py @@ -16,10 +16,26 @@ class Settings(TypedDict, total=False): """ If enabled, causes the CNAME record to be resolved externally and the resulting address records (e.g., A and AAAA) to be returned instead of the CNAME record - itself. This setting has no effect on proxied records, which are always + itself. This setting is unavailable for proxied records, since they are always flattened. """ + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + class CNAMERecordParam(TypedDict, total=False): comment: str @@ -41,6 +57,7 @@ class CNAMERecordParam(TypedDict, total=False): """ settings: Settings + """Settings for the DNS record.""" tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/dnskey_record.py b/src/cloudflare/types/dns/dnskey_record.py index 650e258205b..b7ab534a265 100644 --- a/src/cloudflare/types/dns/dnskey_record.py +++ b/src/cloudflare/types/dns/dnskey_record.py @@ -7,7 +7,7 @@ from ..._models import BaseModel from .record_tags import RecordTags -__all__ = ["DNSKEYRecord", "Data"] +__all__ = ["DNSKEYRecord", "Data", "Settings"] class Data(BaseModel): @@ -24,6 +24,24 @@ class Data(BaseModel): """Public Key.""" +class Settings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class DNSKEYRecord(BaseModel): comment: Optional[str] = None """Comments or notes about the DNS record. @@ -46,6 +64,9 @@ class DNSKEYRecord(BaseModel): Cloudflare. """ + settings: Optional[Settings] = None + """Settings for the DNS record.""" + tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/dnskey_record_param.py b/src/cloudflare/types/dns/dnskey_record_param.py index daba9a3225e..87784bd7f8c 100644 --- a/src/cloudflare/types/dns/dnskey_record_param.py +++ b/src/cloudflare/types/dns/dnskey_record_param.py @@ -8,7 +8,7 @@ from .ttl_param import TTLParam from .record_tags import RecordTags -__all__ = ["DNSKEYRecordParam", "Data"] +__all__ = ["DNSKEYRecordParam", "Data", "Settings"] class Data(TypedDict, total=False): @@ -25,6 +25,24 @@ class Data(TypedDict, total=False): """Public Key.""" +class Settings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class DNSKEYRecordParam(TypedDict, total=False): comment: str """Comments or notes about the DNS record. @@ -44,6 +62,9 @@ class DNSKEYRecordParam(TypedDict, total=False): Cloudflare. """ + settings: Settings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/ds_record.py b/src/cloudflare/types/dns/ds_record.py index 2d13516a67e..7a6f2b87cfc 100644 --- a/src/cloudflare/types/dns/ds_record.py +++ b/src/cloudflare/types/dns/ds_record.py @@ -7,7 +7,7 @@ from ..._models import BaseModel from .record_tags import RecordTags -__all__ = ["DSRecord", "Data"] +__all__ = ["DSRecord", "Data", "Settings"] class Data(BaseModel): @@ -24,6 +24,24 @@ class Data(BaseModel): """Key Tag.""" +class Settings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class DSRecord(BaseModel): comment: Optional[str] = None """Comments or notes about the DNS record. @@ -46,6 +64,9 @@ class DSRecord(BaseModel): Cloudflare. """ + settings: Optional[Settings] = None + """Settings for the DNS record.""" + tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/ds_record_param.py b/src/cloudflare/types/dns/ds_record_param.py index 14618b80a4b..b37b3e538b2 100644 --- a/src/cloudflare/types/dns/ds_record_param.py +++ b/src/cloudflare/types/dns/ds_record_param.py @@ -8,7 +8,7 @@ from .ttl_param import TTLParam from .record_tags import RecordTags -__all__ = ["DSRecordParam", "Data"] +__all__ = ["DSRecordParam", "Data", "Settings"] class Data(TypedDict, total=False): @@ -25,6 +25,24 @@ class Data(TypedDict, total=False): """Key Tag.""" +class Settings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class DSRecordParam(TypedDict, total=False): comment: str """Comments or notes about the DNS record. @@ -44,6 +62,9 @@ class DSRecordParam(TypedDict, total=False): Cloudflare. """ + settings: Settings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/https_record.py b/src/cloudflare/types/dns/https_record.py index 7fb87c4bcf3..9080fc0d2ca 100644 --- a/src/cloudflare/types/dns/https_record.py +++ b/src/cloudflare/types/dns/https_record.py @@ -7,7 +7,7 @@ from ..._models import BaseModel from .record_tags import RecordTags -__all__ = ["HTTPSRecord", "Data"] +__all__ = ["HTTPSRecord", "Data", "Settings"] class Data(BaseModel): @@ -21,6 +21,24 @@ class Data(BaseModel): """value.""" +class Settings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class HTTPSRecord(BaseModel): comment: Optional[str] = None """Comments or notes about the DNS record. @@ -43,6 +61,9 @@ class HTTPSRecord(BaseModel): Cloudflare. """ + settings: Optional[Settings] = None + """Settings for the DNS record.""" + tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/https_record_param.py b/src/cloudflare/types/dns/https_record_param.py index 250fbb445ee..510e57ae626 100644 --- a/src/cloudflare/types/dns/https_record_param.py +++ b/src/cloudflare/types/dns/https_record_param.py @@ -8,7 +8,7 @@ from .ttl_param import TTLParam from .record_tags import RecordTags -__all__ = ["HTTPSRecordParam", "Data"] +__all__ = ["HTTPSRecordParam", "Data", "Settings"] class Data(TypedDict, total=False): @@ -22,6 +22,24 @@ class Data(TypedDict, total=False): """value.""" +class Settings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class HTTPSRecordParam(TypedDict, total=False): comment: str """Comments or notes about the DNS record. @@ -41,6 +59,9 @@ class HTTPSRecordParam(TypedDict, total=False): Cloudflare. """ + settings: Settings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/loc_record.py b/src/cloudflare/types/dns/loc_record.py index 0fa1b139124..6fdf091618b 100644 --- a/src/cloudflare/types/dns/loc_record.py +++ b/src/cloudflare/types/dns/loc_record.py @@ -7,7 +7,7 @@ from ..._models import BaseModel from .record_tags import RecordTags -__all__ = ["LOCRecord", "Data"] +__all__ = ["LOCRecord", "Data", "Settings"] class Data(BaseModel): @@ -48,6 +48,24 @@ class Data(BaseModel): """Size of location in meters.""" +class Settings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class LOCRecord(BaseModel): comment: Optional[str] = None """Comments or notes about the DNS record. @@ -70,6 +88,9 @@ class LOCRecord(BaseModel): Cloudflare. """ + settings: Optional[Settings] = None + """Settings for the DNS record.""" + tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/loc_record_param.py b/src/cloudflare/types/dns/loc_record_param.py index 15b31223784..55ec03b2297 100644 --- a/src/cloudflare/types/dns/loc_record_param.py +++ b/src/cloudflare/types/dns/loc_record_param.py @@ -8,7 +8,7 @@ from .ttl_param import TTLParam from .record_tags import RecordTags -__all__ = ["LOCRecordParam", "Data"] +__all__ = ["LOCRecordParam", "Data", "Settings"] class Data(TypedDict, total=False): @@ -49,6 +49,24 @@ class Data(TypedDict, total=False): """Size of location in meters.""" +class Settings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class LOCRecordParam(TypedDict, total=False): comment: str """Comments or notes about the DNS record. @@ -68,6 +86,9 @@ class LOCRecordParam(TypedDict, total=False): Cloudflare. """ + settings: Settings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/mx_record.py b/src/cloudflare/types/dns/mx_record.py index ef6c49db053..4d3a7dd1874 100644 --- a/src/cloudflare/types/dns/mx_record.py +++ b/src/cloudflare/types/dns/mx_record.py @@ -7,7 +7,25 @@ from ..._models import BaseModel from .record_tags import RecordTags -__all__ = ["MXRecord"] +__all__ = ["MXRecord", "Settings"] + + +class Settings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ class MXRecord(BaseModel): @@ -35,6 +53,9 @@ class MXRecord(BaseModel): Cloudflare. """ + settings: Optional[Settings] = None + """Settings for the DNS record.""" + tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/mx_record_param.py b/src/cloudflare/types/dns/mx_record_param.py index 633211e4684..e38ea7456ca 100644 --- a/src/cloudflare/types/dns/mx_record_param.py +++ b/src/cloudflare/types/dns/mx_record_param.py @@ -8,7 +8,25 @@ from .ttl_param import TTLParam from .record_tags import RecordTags -__all__ = ["MXRecordParam"] +__all__ = ["MXRecordParam", "Settings"] + + +class Settings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ class MXRecordParam(TypedDict, total=False): @@ -36,6 +54,9 @@ class MXRecordParam(TypedDict, total=False): Cloudflare. """ + settings: Settings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/naptr_record.py b/src/cloudflare/types/dns/naptr_record.py index 909bdc97dad..b2fe91864bf 100644 --- a/src/cloudflare/types/dns/naptr_record.py +++ b/src/cloudflare/types/dns/naptr_record.py @@ -7,7 +7,7 @@ from ..._models import BaseModel from .record_tags import RecordTags -__all__ = ["NAPTRRecord", "Data"] +__all__ = ["NAPTRRecord", "Data", "Settings"] class Data(BaseModel): @@ -30,6 +30,24 @@ class Data(BaseModel): """Service.""" +class Settings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class NAPTRRecord(BaseModel): comment: Optional[str] = None """Comments or notes about the DNS record. @@ -52,6 +70,9 @@ class NAPTRRecord(BaseModel): Cloudflare. """ + settings: Optional[Settings] = None + """Settings for the DNS record.""" + tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/naptr_record_param.py b/src/cloudflare/types/dns/naptr_record_param.py index 9511cbba68e..25b91ed4f29 100644 --- a/src/cloudflare/types/dns/naptr_record_param.py +++ b/src/cloudflare/types/dns/naptr_record_param.py @@ -8,7 +8,7 @@ from .ttl_param import TTLParam from .record_tags import RecordTags -__all__ = ["NAPTRRecordParam", "Data"] +__all__ = ["NAPTRRecordParam", "Data", "Settings"] class Data(TypedDict, total=False): @@ -31,6 +31,24 @@ class Data(TypedDict, total=False): """Service.""" +class Settings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class NAPTRRecordParam(TypedDict, total=False): comment: str """Comments or notes about the DNS record. @@ -50,6 +68,9 @@ class NAPTRRecordParam(TypedDict, total=False): Cloudflare. """ + settings: Settings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/ns_record.py b/src/cloudflare/types/dns/ns_record.py index 76e5aaff7c1..78ac6fe4049 100644 --- a/src/cloudflare/types/dns/ns_record.py +++ b/src/cloudflare/types/dns/ns_record.py @@ -7,7 +7,25 @@ from ..._models import BaseModel from .record_tags import RecordTags -__all__ = ["NSRecord"] +__all__ = ["NSRecord", "Settings"] + + +class Settings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ class NSRecord(BaseModel): @@ -29,6 +47,9 @@ class NSRecord(BaseModel): Cloudflare. """ + settings: Optional[Settings] = None + """Settings for the DNS record.""" + tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/ns_record_param.py b/src/cloudflare/types/dns/ns_record_param.py index f036a719ddf..eabb69eedd4 100644 --- a/src/cloudflare/types/dns/ns_record_param.py +++ b/src/cloudflare/types/dns/ns_record_param.py @@ -8,7 +8,25 @@ from .ttl_param import TTLParam from .record_tags import RecordTags -__all__ = ["NSRecordParam"] +__all__ = ["NSRecordParam", "Settings"] + + +class Settings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ class NSRecordParam(TypedDict, total=False): @@ -30,6 +48,9 @@ class NSRecordParam(TypedDict, total=False): Cloudflare. """ + settings: Settings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/ptr_record.py b/src/cloudflare/types/dns/ptr_record.py index 3eee7c802d1..c392256cbbc 100644 --- a/src/cloudflare/types/dns/ptr_record.py +++ b/src/cloudflare/types/dns/ptr_record.py @@ -7,7 +7,25 @@ from ..._models import BaseModel from .record_tags import RecordTags -__all__ = ["PTRRecord"] +__all__ = ["PTRRecord", "Settings"] + + +class Settings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ class PTRRecord(BaseModel): @@ -29,6 +47,9 @@ class PTRRecord(BaseModel): Cloudflare. """ + settings: Optional[Settings] = None + """Settings for the DNS record.""" + tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/ptr_record_param.py b/src/cloudflare/types/dns/ptr_record_param.py index d0390797c51..82d92c301fd 100644 --- a/src/cloudflare/types/dns/ptr_record_param.py +++ b/src/cloudflare/types/dns/ptr_record_param.py @@ -8,7 +8,25 @@ from .ttl_param import TTLParam from .record_tags import RecordTags -__all__ = ["PTRRecordParam"] +__all__ = ["PTRRecordParam", "Settings"] + + +class Settings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ class PTRRecordParam(TypedDict, total=False): @@ -30,6 +48,9 @@ class PTRRecordParam(TypedDict, total=False): Cloudflare. """ + settings: Settings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/record_batch_params.py b/src/cloudflare/types/dns/record_batch_params.py index 3b9a78fbd2f..cb31cfdef94 100644 --- a/src/cloudflare/types/dns/record_batch_params.py +++ b/src/cloudflare/types/dns/record_batch_params.py @@ -2,81 +2,14 @@ from __future__ import annotations -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, TypeAlias, TypedDict +from typing import Iterable +from typing_extensions import Required, TypedDict -from .ttl_param import TTLParam -from .record_tags import RecordTags from .record_param import RecordParam -from .a_record_param import ARecordParam -from .ds_record_param import DSRecordParam -from .mx_record_param import MXRecordParam -from .ns_record_param import NSRecordParam -from .caa_record_param import CAARecordParam -from .loc_record_param import LOCRecordParam -from .ptr_record_param import PTRRecordParam -from .srv_record_param import SRVRecordParam -from .txt_record_param import TXTRecordParam -from .uri_record_param import URIRecordParam -from .aaaa_record_param import AAAARecordParam -from .cert_record_param import CERTRecordParam -from .svcb_record_param import SVCBRecordParam -from .tlsa_record_param import TLSARecordParam -from .cname_record_param import CNAMERecordParam -from .https_record_param import HTTPSRecordParam -from .naptr_record_param import NAPTRRecordParam -from .sshfp_record_param import SSHFPRecordParam -from .dnskey_record_param import DNSKEYRecordParam -from .smimea_record_param import SMIMEARecordParam +from .batch_put_param import BatchPutParam +from .batch_patch_param import BatchPatchParam -__all__ = [ - "RecordBatchParams", - "Delete", - "Patch", - "PatchARecord", - "PatchAAAARecord", - "PatchCAARecord", - "PatchCERTRecord", - "PatchCNAMERecord", - "PatchDNSKEYRecord", - "PatchDSRecord", - "PatchHTTPSRecord", - "PatchLOCRecord", - "PatchMXRecord", - "PatchNAPTRRecord", - "PatchNSRecord", - "PatchOpenpgpkeyRecord", - "PatchPTRRecord", - "PatchSMIMEARecord", - "PatchSRVRecord", - "PatchSSHFPRecord", - "PatchSVCBRecord", - "PatchTLSARecord", - "PatchTXTRecord", - "PatchURIRecord", - "Put", - "PutARecord", - "PutAAAARecord", - "PutCAARecord", - "PutCERTRecord", - "PutCNAMERecord", - "PutDNSKEYRecord", - "PutDSRecord", - "PutHTTPSRecord", - "PutLOCRecord", - "PutMXRecord", - "PutNAPTRRecord", - "PutNSRecord", - "PutOpenpgpkeyRecord", - "PutPTRRecord", - "PutSMIMEARecord", - "PutSRVRecord", - "PutSSHFPRecord", - "PutSVCBRecord", - "PutTLSARecord", - "PutTXTRecord", - "PutURIRecord", -] +__all__ = ["RecordBatchParams", "Delete"] class RecordBatchParams(TypedDict, total=False): @@ -85,335 +18,13 @@ class RecordBatchParams(TypedDict, total=False): deletes: Iterable[Delete] - patches: Iterable[Patch] + patches: Iterable[BatchPatchParam] posts: Iterable[RecordParam] - puts: Iterable[Put] + puts: Iterable[BatchPutParam] class Delete(TypedDict, total=False): id: Required[str] """Identifier""" - - -class PatchARecord(ARecordParam): - id: Required[str] - """Identifier""" - - -class PatchAAAARecord(AAAARecordParam): - id: Required[str] - """Identifier""" - - -class PatchCAARecord(CAARecordParam): - id: Required[str] - """Identifier""" - - -class PatchCERTRecord(CERTRecordParam): - id: Required[str] - """Identifier""" - - -class PatchCNAMERecord(CNAMERecordParam): - id: Required[str] - """Identifier""" - - -class PatchDNSKEYRecord(DNSKEYRecordParam): - id: Required[str] - """Identifier""" - - -class PatchDSRecord(DSRecordParam): - id: Required[str] - """Identifier""" - - -class PatchHTTPSRecord(HTTPSRecordParam): - id: Required[str] - """Identifier""" - - -class PatchLOCRecord(LOCRecordParam): - id: Required[str] - """Identifier""" - - -class PatchMXRecord(MXRecordParam): - id: Required[str] - """Identifier""" - - -class PatchNAPTRRecord(NAPTRRecordParam): - id: Required[str] - """Identifier""" - - -class PatchNSRecord(NSRecordParam): - id: Required[str] - """Identifier""" - - -class PatchOpenpgpkeyRecord(TypedDict, total=False): - id: Required[str] - """Identifier""" - - comment: str - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: str - """A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1)""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - proxied: bool - """ - Whether the record is receiving the performance and security benefits of - Cloudflare. - """ - - tags: List[RecordTags] - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: TTLParam - """Time To Live (TTL) of the DNS record in seconds. - - Setting to 1 means 'automatic'. Value must be between 60 and 86400, with the - minimum reduced to 30 for Enterprise zones. - """ - - type: Literal["OPENPGPKEY"] - """Record type.""" - - -class PatchPTRRecord(PTRRecordParam): - id: Required[str] - """Identifier""" - - -class PatchSMIMEARecord(SMIMEARecordParam): - id: Required[str] - """Identifier""" - - -class PatchSRVRecord(SRVRecordParam): - id: Required[str] - """Identifier""" - - -class PatchSSHFPRecord(SSHFPRecordParam): - id: Required[str] - """Identifier""" - - -class PatchSVCBRecord(SVCBRecordParam): - id: Required[str] - """Identifier""" - - -class PatchTLSARecord(TLSARecordParam): - id: Required[str] - """Identifier""" - - -class PatchTXTRecord(TXTRecordParam): - id: Required[str] - """Identifier""" - - -class PatchURIRecord(URIRecordParam): - id: Required[str] - """Identifier""" - - -Patch: TypeAlias = Union[ - PatchARecord, - PatchAAAARecord, - PatchCAARecord, - PatchCERTRecord, - PatchCNAMERecord, - PatchDNSKEYRecord, - PatchDSRecord, - PatchHTTPSRecord, - PatchLOCRecord, - PatchMXRecord, - PatchNAPTRRecord, - PatchNSRecord, - PatchOpenpgpkeyRecord, - PatchPTRRecord, - PatchSMIMEARecord, - PatchSRVRecord, - PatchSSHFPRecord, - PatchSVCBRecord, - PatchTLSARecord, - PatchTXTRecord, - PatchURIRecord, -] - - -class PutARecord(ARecordParam): - id: Required[str] - """Identifier""" - - -class PutAAAARecord(AAAARecordParam): - id: Required[str] - """Identifier""" - - -class PutCAARecord(CAARecordParam): - id: Required[str] - """Identifier""" - - -class PutCERTRecord(CERTRecordParam): - id: Required[str] - """Identifier""" - - -class PutCNAMERecord(CNAMERecordParam): - id: Required[str] - """Identifier""" - - -class PutDNSKEYRecord(DNSKEYRecordParam): - id: Required[str] - """Identifier""" - - -class PutDSRecord(DSRecordParam): - id: Required[str] - """Identifier""" - - -class PutHTTPSRecord(HTTPSRecordParam): - id: Required[str] - """Identifier""" - - -class PutLOCRecord(LOCRecordParam): - id: Required[str] - """Identifier""" - - -class PutMXRecord(MXRecordParam): - id: Required[str] - """Identifier""" - - -class PutNAPTRRecord(NAPTRRecordParam): - id: Required[str] - """Identifier""" - - -class PutNSRecord(NSRecordParam): - id: Required[str] - """Identifier""" - - -class PutOpenpgpkeyRecord(TypedDict, total=False): - id: Required[str] - """Identifier""" - - content: Required[str] - """A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1)""" - - name: Required[str] - """DNS record name (or @ for the zone apex) in Punycode.""" - - type: Required[Literal["OPENPGPKEY"]] - """Record type.""" - - comment: str - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - proxied: bool - """ - Whether the record is receiving the performance and security benefits of - Cloudflare. - """ - - tags: List[RecordTags] - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: TTLParam - """Time To Live (TTL) of the DNS record in seconds. - - Setting to 1 means 'automatic'. Value must be between 60 and 86400, with the - minimum reduced to 30 for Enterprise zones. - """ - - -class PutPTRRecord(PTRRecordParam): - id: Required[str] - """Identifier""" - - -class PutSMIMEARecord(SMIMEARecordParam): - id: Required[str] - """Identifier""" - - -class PutSRVRecord(SRVRecordParam): - id: Required[str] - """Identifier""" - - -class PutSSHFPRecord(SSHFPRecordParam): - id: Required[str] - """Identifier""" - - -class PutSVCBRecord(SVCBRecordParam): - id: Required[str] - """Identifier""" - - -class PutTLSARecord(TLSARecordParam): - id: Required[str] - """Identifier""" - - -class PutTXTRecord(TXTRecordParam): - id: Required[str] - """Identifier""" - - -class PutURIRecord(URIRecordParam): - id: Required[str] - """Identifier""" - - -Put: TypeAlias = Union[ - PutARecord, - PutAAAARecord, - PutCAARecord, - PutCERTRecord, - PutCNAMERecord, - PutDNSKEYRecord, - PutDSRecord, - PutHTTPSRecord, - PutLOCRecord, - PutMXRecord, - PutNAPTRRecord, - PutNSRecord, - PutOpenpgpkeyRecord, - PutPTRRecord, - PutSMIMEARecord, - PutSRVRecord, - PutSSHFPRecord, - PutSVCBRecord, - PutTLSARecord, - PutTXTRecord, - PutURIRecord, -] diff --git a/src/cloudflare/types/dns/record_batch_response.py b/src/cloudflare/types/dns/record_batch_response.py index c11f212f328..4bdc03c4b1c 100644 --- a/src/cloudflare/types/dns/record_batch_response.py +++ b/src/cloudflare/types/dns/record_batch_response.py @@ -1,2287 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias +from typing import List, Optional -from .ttl import TTL -from .a_record import ARecord from ..._models import BaseModel -from .ds_record import DSRecord -from .mx_record import MXRecord -from .ns_record import NSRecord -from .caa_record import CAARecord -from .loc_record import LOCRecord -from .ptr_record import PTRRecord -from .srv_record import SRVRecord -from .txt_record import TXTRecord -from .uri_record import URIRecord -from .aaaa_record import AAAARecord -from .cert_record import CERTRecord -from .record_tags import RecordTags -from .svcb_record import SVCBRecord -from .tlsa_record import TLSARecord -from .cname_record import CNAMERecord -from .https_record import HTTPSRecord -from .naptr_record import NAPTRRecord -from .sshfp_record import SSHFPRecord -from .dnskey_record import DNSKEYRecord -from .smimea_record import SMIMEARecord +from .record_response import RecordResponse -__all__ = [ - "RecordBatchResponse", - "Delete", - "DeleteARecord", - "DeleteAAAARecord", - "DeleteCAARecord", - "DeleteCERTRecord", - "DeleteCNAMERecord", - "DeleteDNSKEYRecord", - "DeleteDSRecord", - "DeleteHTTPSRecord", - "DeleteLOCRecord", - "DeleteMXRecord", - "DeleteNAPTRRecord", - "DeleteNSRecord", - "DeleteOpenpgpkeyRecord", - "DeletePTRRecord", - "DeleteSMIMEARecord", - "DeleteSRVRecord", - "DeleteSSHFPRecord", - "DeleteSVCBRecord", - "DeleteTLSARecord", - "DeleteTXTRecord", - "DeleteURIRecord", - "Patch", - "PatchARecord", - "PatchAAAARecord", - "PatchCAARecord", - "PatchCERTRecord", - "PatchCNAMERecord", - "PatchDNSKEYRecord", - "PatchDSRecord", - "PatchHTTPSRecord", - "PatchLOCRecord", - "PatchMXRecord", - "PatchNAPTRRecord", - "PatchNSRecord", - "PatchOpenpgpkeyRecord", - "PatchPTRRecord", - "PatchSMIMEARecord", - "PatchSRVRecord", - "PatchSSHFPRecord", - "PatchSVCBRecord", - "PatchTLSARecord", - "PatchTXTRecord", - "PatchURIRecord", - "Post", - "PostARecord", - "PostAAAARecord", - "PostCAARecord", - "PostCERTRecord", - "PostCNAMERecord", - "PostDNSKEYRecord", - "PostDSRecord", - "PostHTTPSRecord", - "PostLOCRecord", - "PostMXRecord", - "PostNAPTRRecord", - "PostNSRecord", - "PostOpenpgpkeyRecord", - "PostPTRRecord", - "PostSMIMEARecord", - "PostSRVRecord", - "PostSSHFPRecord", - "PostSVCBRecord", - "PostTLSARecord", - "PostTXTRecord", - "PostURIRecord", - "Put", - "PutARecord", - "PutAAAARecord", - "PutCAARecord", - "PutCERTRecord", - "PutCNAMERecord", - "PutDNSKEYRecord", - "PutDSRecord", - "PutHTTPSRecord", - "PutLOCRecord", - "PutMXRecord", - "PutNAPTRRecord", - "PutNSRecord", - "PutOpenpgpkeyRecord", - "PutPTRRecord", - "PutSMIMEARecord", - "PutSRVRecord", - "PutSSHFPRecord", - "PutSVCBRecord", - "PutTLSARecord", - "PutTXTRecord", - "PutURIRecord", -] - - -class DeleteARecord(ARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeleteAAAARecord(AAAARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeleteCAARecord(CAARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeleteCERTRecord(CERTRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeleteCNAMERecord(CNAMERecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeleteDNSKEYRecord(DNSKEYRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeleteDSRecord(DSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeleteHTTPSRecord(HTTPSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeleteLOCRecord(LOCRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeleteMXRecord(MXRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeleteNAPTRRecord(NAPTRRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeleteNSRecord(NSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeleteOpenpgpkeyRecord(BaseModel): - id: str - """Identifier""" - - comment: str - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: str - """A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1)""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - proxied: bool - """ - Whether the record is receiving the performance and security benefits of - Cloudflare. - """ - - tags: List[RecordTags] - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: TTL - """Time To Live (TTL) of the DNS record in seconds. - - Setting to 1 means 'automatic'. Value must be between 60 and 86400, with the - minimum reduced to 30 for Enterprise zones. - """ - - type: Literal["OPENPGPKEY"] - """Record type.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeletePTRRecord(PTRRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeleteSMIMEARecord(SMIMEARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeleteSRVRecord(SRVRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeleteSSHFPRecord(SSHFPRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeleteSVCBRecord(SVCBRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeleteTLSARecord(TLSARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeleteTXTRecord(TXTRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DeleteURIRecord(URIRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -Delete: TypeAlias = Union[ - DeleteARecord, - DeleteAAAARecord, - DeleteCAARecord, - DeleteCERTRecord, - DeleteCNAMERecord, - DeleteDNSKEYRecord, - DeleteDSRecord, - DeleteHTTPSRecord, - DeleteLOCRecord, - DeleteMXRecord, - DeleteNAPTRRecord, - DeleteNSRecord, - DeleteOpenpgpkeyRecord, - DeletePTRRecord, - DeleteSMIMEARecord, - DeleteSRVRecord, - DeleteSSHFPRecord, - DeleteSVCBRecord, - DeleteTLSARecord, - DeleteTXTRecord, - DeleteURIRecord, -] - - -class PatchARecord(ARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchAAAARecord(AAAARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchCAARecord(CAARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchCERTRecord(CERTRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchCNAMERecord(CNAMERecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchDNSKEYRecord(DNSKEYRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchDSRecord(DSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchHTTPSRecord(HTTPSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchLOCRecord(LOCRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchMXRecord(MXRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchNAPTRRecord(NAPTRRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchNSRecord(NSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchOpenpgpkeyRecord(BaseModel): - id: str - """Identifier""" - - comment: str - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: str - """A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1)""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - proxied: bool - """ - Whether the record is receiving the performance and security benefits of - Cloudflare. - """ - - tags: List[RecordTags] - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: TTL - """Time To Live (TTL) of the DNS record in seconds. - - Setting to 1 means 'automatic'. Value must be between 60 and 86400, with the - minimum reduced to 30 for Enterprise zones. - """ - - type: Literal["OPENPGPKEY"] - """Record type.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchPTRRecord(PTRRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchSMIMEARecord(SMIMEARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchSRVRecord(SRVRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchSSHFPRecord(SSHFPRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchSVCBRecord(SVCBRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchTLSARecord(TLSARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchTXTRecord(TXTRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PatchURIRecord(URIRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -Patch: TypeAlias = Union[ - PatchARecord, - PatchAAAARecord, - PatchCAARecord, - PatchCERTRecord, - PatchCNAMERecord, - PatchDNSKEYRecord, - PatchDSRecord, - PatchHTTPSRecord, - PatchLOCRecord, - PatchMXRecord, - PatchNAPTRRecord, - PatchNSRecord, - PatchOpenpgpkeyRecord, - PatchPTRRecord, - PatchSMIMEARecord, - PatchSRVRecord, - PatchSSHFPRecord, - PatchSVCBRecord, - PatchTLSARecord, - PatchTXTRecord, - PatchURIRecord, -] - - -class PostARecord(ARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostAAAARecord(AAAARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostCAARecord(CAARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostCERTRecord(CERTRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostCNAMERecord(CNAMERecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostDNSKEYRecord(DNSKEYRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostDSRecord(DSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostHTTPSRecord(HTTPSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostLOCRecord(LOCRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostMXRecord(MXRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostNAPTRRecord(NAPTRRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostNSRecord(NSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostOpenpgpkeyRecord(BaseModel): - id: str - """Identifier""" - - comment: str - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: str - """A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1)""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - proxied: bool - """ - Whether the record is receiving the performance and security benefits of - Cloudflare. - """ - - tags: List[RecordTags] - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: TTL - """Time To Live (TTL) of the DNS record in seconds. - - Setting to 1 means 'automatic'. Value must be between 60 and 86400, with the - minimum reduced to 30 for Enterprise zones. - """ - - type: Literal["OPENPGPKEY"] - """Record type.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostPTRRecord(PTRRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostSMIMEARecord(SMIMEARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostSRVRecord(SRVRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostSSHFPRecord(SSHFPRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostSVCBRecord(SVCBRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostTLSARecord(TLSARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostTXTRecord(TXTRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PostURIRecord(URIRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -Post: TypeAlias = Union[ - PostARecord, - PostAAAARecord, - PostCAARecord, - PostCERTRecord, - PostCNAMERecord, - PostDNSKEYRecord, - PostDSRecord, - PostHTTPSRecord, - PostLOCRecord, - PostMXRecord, - PostNAPTRRecord, - PostNSRecord, - PostOpenpgpkeyRecord, - PostPTRRecord, - PostSMIMEARecord, - PostSRVRecord, - PostSSHFPRecord, - PostSVCBRecord, - PostTLSARecord, - PostTXTRecord, - PostURIRecord, -] - - -class PutARecord(ARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutAAAARecord(AAAARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutCAARecord(CAARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutCERTRecord(CERTRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutCNAMERecord(CNAMERecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutDNSKEYRecord(DNSKEYRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutDSRecord(DSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutHTTPSRecord(HTTPSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutLOCRecord(LOCRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutMXRecord(MXRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutNAPTRRecord(NAPTRRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutNSRecord(NSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutOpenpgpkeyRecord(BaseModel): - id: str - """Identifier""" - - comment: str - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: str - """A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1)""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - proxied: bool - """ - Whether the record is receiving the performance and security benefits of - Cloudflare. - """ - - tags: List[RecordTags] - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: TTL - """Time To Live (TTL) of the DNS record in seconds. - - Setting to 1 means 'automatic'. Value must be between 60 and 86400, with the - minimum reduced to 30 for Enterprise zones. - """ - - type: Literal["OPENPGPKEY"] - """Record type.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutPTRRecord(PTRRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutSMIMEARecord(SMIMEARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutSRVRecord(SRVRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutSSHFPRecord(SSHFPRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutSVCBRecord(SVCBRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutTLSARecord(TLSARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutTXTRecord(TXTRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PutURIRecord(URIRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -Put: TypeAlias = Union[ - PutARecord, - PutAAAARecord, - PutCAARecord, - PutCERTRecord, - PutCNAMERecord, - PutDNSKEYRecord, - PutDSRecord, - PutHTTPSRecord, - PutLOCRecord, - PutMXRecord, - PutNAPTRRecord, - PutNSRecord, - PutOpenpgpkeyRecord, - PutPTRRecord, - PutSMIMEARecord, - PutSRVRecord, - PutSSHFPRecord, - PutSVCBRecord, - PutTLSARecord, - PutTXTRecord, - PutURIRecord, -] +__all__ = ["RecordBatchResponse"] class RecordBatchResponse(BaseModel): - deletes: Optional[List[Delete]] = None + deletes: Optional[List[RecordResponse]] = None - patches: Optional[List[Patch]] = None + patches: Optional[List[RecordResponse]] = None - posts: Optional[List[Post]] = None + posts: Optional[List[RecordResponse]] = None - puts: Optional[List[Put]] = None + puts: Optional[List[RecordResponse]] = None diff --git a/src/cloudflare/types/dns/record_create_params.py b/src/cloudflare/types/dns/record_create_params.py index b9ce9b46a95..c04cfc7995e 100644 --- a/src/cloudflare/types/dns/record_create_params.py +++ b/src/cloudflare/types/dns/record_create_params.py @@ -11,40 +11,60 @@ __all__ = [ "RecordCreateParams", "ARecord", + "ARecordSettings", "AAAARecord", + "AAAARecordSettings", "CAARecord", "CAARecordData", + "CAARecordSettings", "CERTRecord", "CERTRecordData", + "CERTRecordSettings", "CNAMERecord", "CNAMERecordSettings", "DNSKEYRecord", "DNSKEYRecordData", + "DNSKEYRecordSettings", "DSRecord", "DSRecordData", + "DSRecordSettings", "HTTPSRecord", "HTTPSRecordData", + "HTTPSRecordSettings", "LOCRecord", "LOCRecordData", + "LOCRecordSettings", "MXRecord", + "MXRecordSettings", "NAPTRRecord", "NAPTRRecordData", + "NAPTRRecordSettings", "NSRecord", + "NSRecordSettings", "DNSRecordsOpenpgpkeyRecord", + "DNSRecordsOpenpgpkeyRecordSettings", "PTRRecord", + "PTRRecordSettings", "SMIMEARecord", "SMIMEARecordData", + "SMIMEARecordSettings", "SRVRecord", "SRVRecordData", + "SRVRecordSettings", "SSHFPRecord", "SSHFPRecordData", + "SSHFPRecordSettings", "SVCBRecord", "SVCBRecordData", + "SVCBRecordSettings", "TLSARecord", "TLSARecordData", + "TLSARecordSettings", "TXTRecord", + "TXTRecordSettings", "URIRecord", "URIRecordData", + "URIRecordSettings", ] @@ -70,6 +90,9 @@ class ARecord(TypedDict, total=False): Cloudflare. """ + settings: ARecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -84,6 +107,24 @@ class ARecord(TypedDict, total=False): """Record type.""" +class ARecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class AAAARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -106,6 +147,9 @@ class AAAARecord(TypedDict, total=False): Cloudflare. """ + settings: AAAARecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -120,6 +164,24 @@ class AAAARecord(TypedDict, total=False): """Record type.""" +class AAAARecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class CAARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -142,6 +204,9 @@ class CAARecord(TypedDict, total=False): Cloudflare. """ + settings: CAARecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -167,6 +232,24 @@ class CAARecordData(TypedDict, total=False): """Value of the record. This field's semantics depend on the chosen tag.""" +class CAARecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class CERTRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -189,6 +272,9 @@ class CERTRecord(TypedDict, total=False): Cloudflare. """ + settings: CERTRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -217,6 +303,24 @@ class CERTRecordData(TypedDict, total=False): """Type.""" +class CERTRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class CNAMERecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -240,6 +344,7 @@ class CNAMERecord(TypedDict, total=False): """ settings: CNAMERecordSettings + """Settings for the DNS record.""" tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -260,10 +365,26 @@ class CNAMERecordSettings(TypedDict, total=False): """ If enabled, causes the CNAME record to be resolved externally and the resulting address records (e.g., A and AAAA) to be returned instead of the CNAME record - itself. This setting has no effect on proxied records, which are always + itself. This setting is unavailable for proxied records, since they are always flattened. """ + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + class DNSKEYRecord(TypedDict, total=False): zone_id: Required[str] @@ -287,6 +408,9 @@ class DNSKEYRecord(TypedDict, total=False): Cloudflare. """ + settings: DNSKEYRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -315,6 +439,24 @@ class DNSKEYRecordData(TypedDict, total=False): """Public Key.""" +class DNSKEYRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class DSRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -337,6 +479,9 @@ class DSRecord(TypedDict, total=False): Cloudflare. """ + settings: DSRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -365,6 +510,24 @@ class DSRecordData(TypedDict, total=False): """Key Tag.""" +class DSRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class HTTPSRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -387,6 +550,9 @@ class HTTPSRecord(TypedDict, total=False): Cloudflare. """ + settings: HTTPSRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -412,6 +578,24 @@ class HTTPSRecordData(TypedDict, total=False): """value.""" +class HTTPSRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class LOCRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -434,6 +618,9 @@ class LOCRecord(TypedDict, total=False): Cloudflare. """ + settings: LOCRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -486,6 +673,24 @@ class LOCRecordData(TypedDict, total=False): """Size of location in meters.""" +class LOCRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class MXRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -514,6 +719,9 @@ class MXRecord(TypedDict, total=False): Cloudflare. """ + settings: MXRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -528,6 +736,24 @@ class MXRecord(TypedDict, total=False): """Record type.""" +class MXRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class NAPTRRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -550,6 +776,9 @@ class NAPTRRecord(TypedDict, total=False): Cloudflare. """ + settings: NAPTRRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -584,6 +813,24 @@ class NAPTRRecordData(TypedDict, total=False): """Service.""" +class NAPTRRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class NSRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -606,6 +853,9 @@ class NSRecord(TypedDict, total=False): Cloudflare. """ + settings: NSRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -620,6 +870,24 @@ class NSRecord(TypedDict, total=False): """Record type.""" +class NSRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class DNSRecordsOpenpgpkeyRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -642,6 +910,9 @@ class DNSRecordsOpenpgpkeyRecord(TypedDict, total=False): Cloudflare. """ + settings: DNSRecordsOpenpgpkeyRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -656,6 +927,24 @@ class DNSRecordsOpenpgpkeyRecord(TypedDict, total=False): """Record type.""" +class DNSRecordsOpenpgpkeyRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class PTRRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -678,6 +967,9 @@ class PTRRecord(TypedDict, total=False): Cloudflare. """ + settings: PTRRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -692,6 +984,24 @@ class PTRRecord(TypedDict, total=False): """Record type.""" +class PTRRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SMIMEARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -714,6 +1024,9 @@ class SMIMEARecord(TypedDict, total=False): Cloudflare. """ + settings: SMIMEARecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -742,6 +1055,24 @@ class SMIMEARecordData(TypedDict, total=False): """Usage.""" +class SMIMEARecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SRVRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -764,6 +1095,9 @@ class SRVRecord(TypedDict, total=False): Cloudflare. """ + settings: SRVRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -795,6 +1129,24 @@ class SRVRecordData(TypedDict, total=False): """The record weight.""" +class SRVRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SSHFPRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -817,6 +1169,9 @@ class SSHFPRecord(TypedDict, total=False): Cloudflare. """ + settings: SSHFPRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -842,6 +1197,24 @@ class SSHFPRecordData(TypedDict, total=False): """type.""" +class SSHFPRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SVCBRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -864,6 +1237,9 @@ class SVCBRecord(TypedDict, total=False): Cloudflare. """ + settings: SVCBRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -889,6 +1265,24 @@ class SVCBRecordData(TypedDict, total=False): """value.""" +class SVCBRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class TLSARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -911,6 +1305,9 @@ class TLSARecord(TypedDict, total=False): Cloudflare. """ + settings: TLSARecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -939,6 +1336,24 @@ class TLSARecordData(TypedDict, total=False): """Usage.""" +class TLSARecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class TXTRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -969,6 +1384,9 @@ class TXTRecord(TypedDict, total=False): Cloudflare. """ + settings: TXTRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -983,6 +1401,24 @@ class TXTRecord(TypedDict, total=False): """Record type.""" +class TXTRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class URIRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -1011,6 +1447,9 @@ class URIRecord(TypedDict, total=False): Cloudflare. """ + settings: URIRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -1033,6 +1472,24 @@ class URIRecordData(TypedDict, total=False): """The record weight.""" +class URIRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + RecordCreateParams: TypeAlias = Union[ ARecord, AAAARecord, diff --git a/src/cloudflare/types/dns/record_create_response.py b/src/cloudflare/types/dns/record_create_response.py deleted file mode 100644 index ae0ed8bb218..00000000000 --- a/src/cloudflare/types/dns/record_create_response.py +++ /dev/null @@ -1,595 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from . import ( - a_record, - ds_record, - mx_record, - ns_record, - caa_record, - loc_record, - ptr_record, - srv_record, - txt_record, - uri_record, - aaaa_record, - cert_record, - svcb_record, - tlsa_record, - cname_record, - https_record, - naptr_record, - sshfp_record, - dnskey_record, - smimea_record, -) -from .ttl import TTL -from ..._models import BaseModel -from .record_tags import RecordTags - -__all__ = [ - "RecordCreateResponse", - "ARecord", - "AAAARecord", - "CAARecord", - "CERTRecord", - "CNAMERecord", - "DNSKEYRecord", - "DSRecord", - "HTTPSRecord", - "LOCRecord", - "MXRecord", - "NAPTRRecord", - "NSRecord", - "OpenpgpkeyRecord", - "PTRRecord", - "SMIMEARecord", - "SRVRecord", - "SSHFPRecord", - "SVCBRecord", - "TLSARecord", - "TXTRecord", - "URIRecord", -] - - -class ARecord(a_record.ARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class AAAARecord(aaaa_record.AAAARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class CAARecord(caa_record.CAARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class CERTRecord(cert_record.CERTRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class CNAMERecord(cname_record.CNAMERecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DNSKEYRecord(dnskey_record.DNSKEYRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DSRecord(ds_record.DSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class HTTPSRecord(https_record.HTTPSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class LOCRecord(loc_record.LOCRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class MXRecord(mx_record.MXRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class NAPTRRecord(naptr_record.NAPTRRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class NSRecord(ns_record.NSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class OpenpgpkeyRecord(BaseModel): - id: str - """Identifier""" - - comment: str - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: str - """A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1)""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - proxied: bool - """ - Whether the record is receiving the performance and security benefits of - Cloudflare. - """ - - tags: List[RecordTags] - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: TTL - """Time To Live (TTL) of the DNS record in seconds. - - Setting to 1 means 'automatic'. Value must be between 60 and 86400, with the - minimum reduced to 30 for Enterprise zones. - """ - - type: Literal["OPENPGPKEY"] - """Record type.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PTRRecord(ptr_record.PTRRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class SMIMEARecord(smimea_record.SMIMEARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class SRVRecord(srv_record.SRVRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class SSHFPRecord(sshfp_record.SSHFPRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class SVCBRecord(svcb_record.SVCBRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class TLSARecord(tlsa_record.TLSARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class TXTRecord(txt_record.TXTRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class URIRecord(uri_record.URIRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -RecordCreateResponse: TypeAlias = Union[ - ARecord, - AAAARecord, - CAARecord, - CERTRecord, - CNAMERecord, - DNSKEYRecord, - DSRecord, - HTTPSRecord, - LOCRecord, - MXRecord, - NAPTRRecord, - NSRecord, - OpenpgpkeyRecord, - PTRRecord, - SMIMEARecord, - SRVRecord, - SSHFPRecord, - SVCBRecord, - TLSARecord, - TXTRecord, - URIRecord, -] diff --git a/src/cloudflare/types/dns/record_edit_params.py b/src/cloudflare/types/dns/record_edit_params.py index 560790f1419..179b94923d9 100644 --- a/src/cloudflare/types/dns/record_edit_params.py +++ b/src/cloudflare/types/dns/record_edit_params.py @@ -11,40 +11,60 @@ __all__ = [ "RecordEditParams", "ARecord", + "ARecordSettings", "AAAARecord", + "AAAARecordSettings", "CAARecord", "CAARecordData", + "CAARecordSettings", "CERTRecord", "CERTRecordData", + "CERTRecordSettings", "CNAMERecord", "CNAMERecordSettings", "DNSKEYRecord", "DNSKEYRecordData", + "DNSKEYRecordSettings", "DSRecord", "DSRecordData", + "DSRecordSettings", "HTTPSRecord", "HTTPSRecordData", + "HTTPSRecordSettings", "LOCRecord", "LOCRecordData", + "LOCRecordSettings", "MXRecord", + "MXRecordSettings", "NAPTRRecord", "NAPTRRecordData", + "NAPTRRecordSettings", "NSRecord", + "NSRecordSettings", "DNSRecordsOpenpgpkeyRecord", + "DNSRecordsOpenpgpkeyRecordSettings", "PTRRecord", + "PTRRecordSettings", "SMIMEARecord", "SMIMEARecordData", + "SMIMEARecordSettings", "SRVRecord", "SRVRecordData", + "SRVRecordSettings", "SSHFPRecord", "SSHFPRecordData", + "SSHFPRecordSettings", "SVCBRecord", "SVCBRecordData", + "SVCBRecordSettings", "TLSARecord", "TLSARecordData", + "TLSARecordSettings", "TXTRecord", + "TXTRecordSettings", "URIRecord", "URIRecordData", + "URIRecordSettings", ] @@ -70,6 +90,9 @@ class ARecord(TypedDict, total=False): Cloudflare. """ + settings: ARecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -84,6 +107,24 @@ class ARecord(TypedDict, total=False): """Record type.""" +class ARecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class AAAARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -106,6 +147,9 @@ class AAAARecord(TypedDict, total=False): Cloudflare. """ + settings: AAAARecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -120,6 +164,24 @@ class AAAARecord(TypedDict, total=False): """Record type.""" +class AAAARecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class CAARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -142,6 +204,9 @@ class CAARecord(TypedDict, total=False): Cloudflare. """ + settings: CAARecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -167,6 +232,24 @@ class CAARecordData(TypedDict, total=False): """Value of the record. This field's semantics depend on the chosen tag.""" +class CAARecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class CERTRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -189,6 +272,9 @@ class CERTRecord(TypedDict, total=False): Cloudflare. """ + settings: CERTRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -217,6 +303,24 @@ class CERTRecordData(TypedDict, total=False): """Type.""" +class CERTRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class CNAMERecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -240,6 +344,7 @@ class CNAMERecord(TypedDict, total=False): """ settings: CNAMERecordSettings + """Settings for the DNS record.""" tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -260,10 +365,26 @@ class CNAMERecordSettings(TypedDict, total=False): """ If enabled, causes the CNAME record to be resolved externally and the resulting address records (e.g., A and AAAA) to be returned instead of the CNAME record - itself. This setting has no effect on proxied records, which are always + itself. This setting is unavailable for proxied records, since they are always flattened. """ + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + class DNSKEYRecord(TypedDict, total=False): zone_id: Required[str] @@ -287,6 +408,9 @@ class DNSKEYRecord(TypedDict, total=False): Cloudflare. """ + settings: DNSKEYRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -315,6 +439,24 @@ class DNSKEYRecordData(TypedDict, total=False): """Public Key.""" +class DNSKEYRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class DSRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -337,6 +479,9 @@ class DSRecord(TypedDict, total=False): Cloudflare. """ + settings: DSRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -365,6 +510,24 @@ class DSRecordData(TypedDict, total=False): """Key Tag.""" +class DSRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class HTTPSRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -387,6 +550,9 @@ class HTTPSRecord(TypedDict, total=False): Cloudflare. """ + settings: HTTPSRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -412,6 +578,24 @@ class HTTPSRecordData(TypedDict, total=False): """value.""" +class HTTPSRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class LOCRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -434,6 +618,9 @@ class LOCRecord(TypedDict, total=False): Cloudflare. """ + settings: LOCRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -486,6 +673,24 @@ class LOCRecordData(TypedDict, total=False): """Size of location in meters.""" +class LOCRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class MXRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -514,6 +719,9 @@ class MXRecord(TypedDict, total=False): Cloudflare. """ + settings: MXRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -528,6 +736,24 @@ class MXRecord(TypedDict, total=False): """Record type.""" +class MXRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class NAPTRRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -550,6 +776,9 @@ class NAPTRRecord(TypedDict, total=False): Cloudflare. """ + settings: NAPTRRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -584,6 +813,24 @@ class NAPTRRecordData(TypedDict, total=False): """Service.""" +class NAPTRRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class NSRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -606,6 +853,9 @@ class NSRecord(TypedDict, total=False): Cloudflare. """ + settings: NSRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -620,6 +870,24 @@ class NSRecord(TypedDict, total=False): """Record type.""" +class NSRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class DNSRecordsOpenpgpkeyRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -642,6 +910,9 @@ class DNSRecordsOpenpgpkeyRecord(TypedDict, total=False): Cloudflare. """ + settings: DNSRecordsOpenpgpkeyRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -656,6 +927,24 @@ class DNSRecordsOpenpgpkeyRecord(TypedDict, total=False): """Record type.""" +class DNSRecordsOpenpgpkeyRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class PTRRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -678,6 +967,9 @@ class PTRRecord(TypedDict, total=False): Cloudflare. """ + settings: PTRRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -692,6 +984,24 @@ class PTRRecord(TypedDict, total=False): """Record type.""" +class PTRRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SMIMEARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -714,6 +1024,9 @@ class SMIMEARecord(TypedDict, total=False): Cloudflare. """ + settings: SMIMEARecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -742,6 +1055,24 @@ class SMIMEARecordData(TypedDict, total=False): """Usage.""" +class SMIMEARecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SRVRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -764,6 +1095,9 @@ class SRVRecord(TypedDict, total=False): Cloudflare. """ + settings: SRVRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -795,6 +1129,24 @@ class SRVRecordData(TypedDict, total=False): """The record weight.""" +class SRVRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SSHFPRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -817,6 +1169,9 @@ class SSHFPRecord(TypedDict, total=False): Cloudflare. """ + settings: SSHFPRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -842,6 +1197,24 @@ class SSHFPRecordData(TypedDict, total=False): """type.""" +class SSHFPRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SVCBRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -864,6 +1237,9 @@ class SVCBRecord(TypedDict, total=False): Cloudflare. """ + settings: SVCBRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -889,6 +1265,24 @@ class SVCBRecordData(TypedDict, total=False): """value.""" +class SVCBRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class TLSARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -911,6 +1305,9 @@ class TLSARecord(TypedDict, total=False): Cloudflare. """ + settings: TLSARecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -939,6 +1336,24 @@ class TLSARecordData(TypedDict, total=False): """Usage.""" +class TLSARecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class TXTRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -969,6 +1384,9 @@ class TXTRecord(TypedDict, total=False): Cloudflare. """ + settings: TXTRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -983,6 +1401,24 @@ class TXTRecord(TypedDict, total=False): """Record type.""" +class TXTRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class URIRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -1011,6 +1447,9 @@ class URIRecord(TypedDict, total=False): Cloudflare. """ + settings: URIRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -1033,6 +1472,24 @@ class URIRecordData(TypedDict, total=False): """The record weight.""" +class URIRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + RecordEditParams: TypeAlias = Union[ ARecord, AAAARecord, diff --git a/src/cloudflare/types/dns/record_get_response.py b/src/cloudflare/types/dns/record_get_response.py deleted file mode 100644 index 35c2ce1092d..00000000000 --- a/src/cloudflare/types/dns/record_get_response.py +++ /dev/null @@ -1,595 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from . import ( - a_record, - ds_record, - mx_record, - ns_record, - caa_record, - loc_record, - ptr_record, - srv_record, - txt_record, - uri_record, - aaaa_record, - cert_record, - svcb_record, - tlsa_record, - cname_record, - https_record, - naptr_record, - sshfp_record, - dnskey_record, - smimea_record, -) -from .ttl import TTL -from ..._models import BaseModel -from .record_tags import RecordTags - -__all__ = [ - "RecordGetResponse", - "ARecord", - "AAAARecord", - "CAARecord", - "CERTRecord", - "CNAMERecord", - "DNSKEYRecord", - "DSRecord", - "HTTPSRecord", - "LOCRecord", - "MXRecord", - "NAPTRRecord", - "NSRecord", - "OpenpgpkeyRecord", - "PTRRecord", - "SMIMEARecord", - "SRVRecord", - "SSHFPRecord", - "SVCBRecord", - "TLSARecord", - "TXTRecord", - "URIRecord", -] - - -class ARecord(a_record.ARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class AAAARecord(aaaa_record.AAAARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class CAARecord(caa_record.CAARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class CERTRecord(cert_record.CERTRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class CNAMERecord(cname_record.CNAMERecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DNSKEYRecord(dnskey_record.DNSKEYRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DSRecord(ds_record.DSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class HTTPSRecord(https_record.HTTPSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class LOCRecord(loc_record.LOCRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class MXRecord(mx_record.MXRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class NAPTRRecord(naptr_record.NAPTRRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class NSRecord(ns_record.NSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class OpenpgpkeyRecord(BaseModel): - id: str - """Identifier""" - - comment: str - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: str - """A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1)""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - proxied: bool - """ - Whether the record is receiving the performance and security benefits of - Cloudflare. - """ - - tags: List[RecordTags] - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: TTL - """Time To Live (TTL) of the DNS record in seconds. - - Setting to 1 means 'automatic'. Value must be between 60 and 86400, with the - minimum reduced to 30 for Enterprise zones. - """ - - type: Literal["OPENPGPKEY"] - """Record type.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PTRRecord(ptr_record.PTRRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class SMIMEARecord(smimea_record.SMIMEARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class SRVRecord(srv_record.SRVRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class SSHFPRecord(sshfp_record.SSHFPRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class SVCBRecord(svcb_record.SVCBRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class TLSARecord(tlsa_record.TLSARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class TXTRecord(txt_record.TXTRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class URIRecord(uri_record.URIRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -RecordGetResponse: TypeAlias = Union[ - ARecord, - AAAARecord, - CAARecord, - CERTRecord, - CNAMERecord, - DNSKEYRecord, - DSRecord, - HTTPSRecord, - LOCRecord, - MXRecord, - NAPTRRecord, - NSRecord, - OpenpgpkeyRecord, - PTRRecord, - SMIMEARecord, - SRVRecord, - SSHFPRecord, - SVCBRecord, - TLSARecord, - TXTRecord, - URIRecord, -] diff --git a/src/cloudflare/types/dns/record_list_response.py b/src/cloudflare/types/dns/record_list_response.py deleted file mode 100644 index db08bb0b1a0..00000000000 --- a/src/cloudflare/types/dns/record_list_response.py +++ /dev/null @@ -1,595 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from . import ( - a_record, - ds_record, - mx_record, - ns_record, - caa_record, - loc_record, - ptr_record, - srv_record, - txt_record, - uri_record, - aaaa_record, - cert_record, - svcb_record, - tlsa_record, - cname_record, - https_record, - naptr_record, - sshfp_record, - dnskey_record, - smimea_record, -) -from .ttl import TTL -from ..._models import BaseModel -from .record_tags import RecordTags - -__all__ = [ - "RecordListResponse", - "ARecord", - "AAAARecord", - "CAARecord", - "CERTRecord", - "CNAMERecord", - "DNSKEYRecord", - "DSRecord", - "HTTPSRecord", - "LOCRecord", - "MXRecord", - "NAPTRRecord", - "NSRecord", - "OpenpgpkeyRecord", - "PTRRecord", - "SMIMEARecord", - "SRVRecord", - "SSHFPRecord", - "SVCBRecord", - "TLSARecord", - "TXTRecord", - "URIRecord", -] - - -class ARecord(a_record.ARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class AAAARecord(aaaa_record.AAAARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class CAARecord(caa_record.CAARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class CERTRecord(cert_record.CERTRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class CNAMERecord(cname_record.CNAMERecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DNSKEYRecord(dnskey_record.DNSKEYRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DSRecord(ds_record.DSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class HTTPSRecord(https_record.HTTPSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class LOCRecord(loc_record.LOCRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class MXRecord(mx_record.MXRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class NAPTRRecord(naptr_record.NAPTRRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class NSRecord(ns_record.NSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class OpenpgpkeyRecord(BaseModel): - id: str - """Identifier""" - - comment: str - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: str - """A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1)""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - proxied: bool - """ - Whether the record is receiving the performance and security benefits of - Cloudflare. - """ - - tags: List[RecordTags] - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: TTL - """Time To Live (TTL) of the DNS record in seconds. - - Setting to 1 means 'automatic'. Value must be between 60 and 86400, with the - minimum reduced to 30 for Enterprise zones. - """ - - type: Literal["OPENPGPKEY"] - """Record type.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PTRRecord(ptr_record.PTRRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class SMIMEARecord(smimea_record.SMIMEARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class SRVRecord(srv_record.SRVRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class SSHFPRecord(sshfp_record.SSHFPRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class SVCBRecord(svcb_record.SVCBRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class TLSARecord(tlsa_record.TLSARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class TXTRecord(txt_record.TXTRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class URIRecord(uri_record.URIRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -RecordListResponse: TypeAlias = Union[ - ARecord, - AAAARecord, - CAARecord, - CERTRecord, - CNAMERecord, - DNSKEYRecord, - DSRecord, - HTTPSRecord, - LOCRecord, - MXRecord, - NAPTRRecord, - NSRecord, - OpenpgpkeyRecord, - PTRRecord, - SMIMEARecord, - SRVRecord, - SSHFPRecord, - SVCBRecord, - TLSARecord, - TXTRecord, - URIRecord, -] diff --git a/src/cloudflare/types/dns/record_param.py b/src/cloudflare/types/dns/record_param.py index 86c91d8b874..fd9202fefef 100644 --- a/src/cloudflare/types/dns/record_param.py +++ b/src/cloudflare/types/dns/record_param.py @@ -28,10 +28,28 @@ from .dnskey_record_param import DNSKEYRecordParam from .smimea_record_param import SMIMEARecordParam -__all__ = ["RecordParam", "DNSRecordsOpenpgpkeyRecord"] +__all__ = ["RecordParam", "Openpgpkey", "OpenpgpkeySettings"] -class DNSRecordsOpenpgpkeyRecord(TypedDict, total=False): +class OpenpgpkeySettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + +class Openpgpkey(TypedDict, total=False): comment: str """Comments or notes about the DNS record. @@ -50,6 +68,9 @@ class DNSRecordsOpenpgpkeyRecord(TypedDict, total=False): Cloudflare. """ + settings: OpenpgpkeySettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -77,7 +98,7 @@ class DNSRecordsOpenpgpkeyRecord(TypedDict, total=False): MXRecordParam, NAPTRRecordParam, NSRecordParam, - DNSRecordsOpenpgpkeyRecord, + Openpgpkey, PTRRecordParam, SMIMEARecordParam, SRVRecordParam, diff --git a/src/cloudflare/types/dns/record_process_timing.py b/src/cloudflare/types/dns/record_process_timing.py deleted file mode 100644 index 1fc4d7db12a..00000000000 --- a/src/cloudflare/types/dns/record_process_timing.py +++ /dev/null @@ -1,19 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from ..._models import BaseModel - -__all__ = ["RecordProcessTiming"] - - -class RecordProcessTiming(BaseModel): - end_time: Optional[datetime] = None - """When the file parsing ended.""" - - process_time: Optional[float] = None - """Processing time of the file in seconds.""" - - start_time: Optional[datetime] = None - """When the file parsing started.""" diff --git a/src/cloudflare/types/dns/record_edit_response.py b/src/cloudflare/types/dns/record_response.py similarity index 94% rename from src/cloudflare/types/dns/record_edit_response.py rename to src/cloudflare/types/dns/record_response.py index 685475e6962..86334c5f111 100644 --- a/src/cloudflare/types/dns/record_edit_response.py +++ b/src/cloudflare/types/dns/record_response.py @@ -31,7 +31,7 @@ from .record_tags import RecordTags __all__ = [ - "RecordEditResponse", + "RecordResponse", "ARecord", "AAAARecord", "CAARecord", @@ -44,7 +44,8 @@ "MXRecord", "NAPTRRecord", "NSRecord", - "OpenpgpkeyRecord", + "Openpgpkey", + "OpenpgpkeySettings", "PTRRecord", "SMIMEARecord", "SRVRecord", @@ -332,7 +333,25 @@ class NSRecord(ns_record.NSRecord): """When the record tags were last modified. Omitted if there are no tags.""" -class OpenpgpkeyRecord(BaseModel): +class OpenpgpkeySettings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + +class Openpgpkey(BaseModel): id: str """Identifier""" @@ -366,6 +385,9 @@ class OpenpgpkeyRecord(BaseModel): Cloudflare. """ + settings: OpenpgpkeySettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -570,7 +592,7 @@ class URIRecord(uri_record.URIRecord): """When the record tags were last modified. Omitted if there are no tags.""" -RecordEditResponse: TypeAlias = Union[ +RecordResponse: TypeAlias = Union[ ARecord, AAAARecord, CAARecord, @@ -583,7 +605,7 @@ class URIRecord(uri_record.URIRecord): MXRecord, NAPTRRecord, NSRecord, - OpenpgpkeyRecord, + Openpgpkey, PTRRecord, SMIMEARecord, SRVRecord, diff --git a/src/cloudflare/types/dns/record_update_params.py b/src/cloudflare/types/dns/record_update_params.py index d959b8c6e1e..e594247fb7e 100644 --- a/src/cloudflare/types/dns/record_update_params.py +++ b/src/cloudflare/types/dns/record_update_params.py @@ -11,40 +11,60 @@ __all__ = [ "RecordUpdateParams", "ARecord", + "ARecordSettings", "AAAARecord", + "AAAARecordSettings", "CAARecord", "CAARecordData", + "CAARecordSettings", "CERTRecord", "CERTRecordData", + "CERTRecordSettings", "CNAMERecord", "CNAMERecordSettings", "DNSKEYRecord", "DNSKEYRecordData", + "DNSKEYRecordSettings", "DSRecord", "DSRecordData", + "DSRecordSettings", "HTTPSRecord", "HTTPSRecordData", + "HTTPSRecordSettings", "LOCRecord", "LOCRecordData", + "LOCRecordSettings", "MXRecord", + "MXRecordSettings", "NAPTRRecord", "NAPTRRecordData", + "NAPTRRecordSettings", "NSRecord", + "NSRecordSettings", "DNSRecordsOpenpgpkeyRecord", + "DNSRecordsOpenpgpkeyRecordSettings", "PTRRecord", + "PTRRecordSettings", "SMIMEARecord", "SMIMEARecordData", + "SMIMEARecordSettings", "SRVRecord", "SRVRecordData", + "SRVRecordSettings", "SSHFPRecord", "SSHFPRecordData", + "SSHFPRecordSettings", "SVCBRecord", "SVCBRecordData", + "SVCBRecordSettings", "TLSARecord", "TLSARecordData", + "TLSARecordSettings", "TXTRecord", + "TXTRecordSettings", "URIRecord", "URIRecordData", + "URIRecordSettings", ] @@ -70,6 +90,9 @@ class ARecord(TypedDict, total=False): Cloudflare. """ + settings: ARecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -84,6 +107,24 @@ class ARecord(TypedDict, total=False): """Record type.""" +class ARecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class AAAARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -106,6 +147,9 @@ class AAAARecord(TypedDict, total=False): Cloudflare. """ + settings: AAAARecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -120,6 +164,24 @@ class AAAARecord(TypedDict, total=False): """Record type.""" +class AAAARecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class CAARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -142,6 +204,9 @@ class CAARecord(TypedDict, total=False): Cloudflare. """ + settings: CAARecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -167,6 +232,24 @@ class CAARecordData(TypedDict, total=False): """Value of the record. This field's semantics depend on the chosen tag.""" +class CAARecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class CERTRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -189,6 +272,9 @@ class CERTRecord(TypedDict, total=False): Cloudflare. """ + settings: CERTRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -217,6 +303,24 @@ class CERTRecordData(TypedDict, total=False): """Type.""" +class CERTRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class CNAMERecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -240,6 +344,7 @@ class CNAMERecord(TypedDict, total=False): """ settings: CNAMERecordSettings + """Settings for the DNS record.""" tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -260,10 +365,26 @@ class CNAMERecordSettings(TypedDict, total=False): """ If enabled, causes the CNAME record to be resolved externally and the resulting address records (e.g., A and AAAA) to be returned instead of the CNAME record - itself. This setting has no effect on proxied records, which are always + itself. This setting is unavailable for proxied records, since they are always flattened. """ + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + class DNSKEYRecord(TypedDict, total=False): zone_id: Required[str] @@ -287,6 +408,9 @@ class DNSKEYRecord(TypedDict, total=False): Cloudflare. """ + settings: DNSKEYRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -315,6 +439,24 @@ class DNSKEYRecordData(TypedDict, total=False): """Public Key.""" +class DNSKEYRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class DSRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -337,6 +479,9 @@ class DSRecord(TypedDict, total=False): Cloudflare. """ + settings: DSRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -365,6 +510,24 @@ class DSRecordData(TypedDict, total=False): """Key Tag.""" +class DSRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class HTTPSRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -387,6 +550,9 @@ class HTTPSRecord(TypedDict, total=False): Cloudflare. """ + settings: HTTPSRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -412,6 +578,24 @@ class HTTPSRecordData(TypedDict, total=False): """value.""" +class HTTPSRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class LOCRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -434,6 +618,9 @@ class LOCRecord(TypedDict, total=False): Cloudflare. """ + settings: LOCRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -486,6 +673,24 @@ class LOCRecordData(TypedDict, total=False): """Size of location in meters.""" +class LOCRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class MXRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -514,6 +719,9 @@ class MXRecord(TypedDict, total=False): Cloudflare. """ + settings: MXRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -528,6 +736,24 @@ class MXRecord(TypedDict, total=False): """Record type.""" +class MXRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class NAPTRRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -550,6 +776,9 @@ class NAPTRRecord(TypedDict, total=False): Cloudflare. """ + settings: NAPTRRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -584,6 +813,24 @@ class NAPTRRecordData(TypedDict, total=False): """Service.""" +class NAPTRRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class NSRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -606,6 +853,9 @@ class NSRecord(TypedDict, total=False): Cloudflare. """ + settings: NSRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -620,6 +870,24 @@ class NSRecord(TypedDict, total=False): """Record type.""" +class NSRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class DNSRecordsOpenpgpkeyRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -642,6 +910,9 @@ class DNSRecordsOpenpgpkeyRecord(TypedDict, total=False): Cloudflare. """ + settings: DNSRecordsOpenpgpkeyRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -656,6 +927,24 @@ class DNSRecordsOpenpgpkeyRecord(TypedDict, total=False): """Record type.""" +class DNSRecordsOpenpgpkeyRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class PTRRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -678,6 +967,9 @@ class PTRRecord(TypedDict, total=False): Cloudflare. """ + settings: PTRRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -692,6 +984,24 @@ class PTRRecord(TypedDict, total=False): """Record type.""" +class PTRRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SMIMEARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -714,6 +1024,9 @@ class SMIMEARecord(TypedDict, total=False): Cloudflare. """ + settings: SMIMEARecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -742,6 +1055,24 @@ class SMIMEARecordData(TypedDict, total=False): """Usage.""" +class SMIMEARecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SRVRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -764,6 +1095,9 @@ class SRVRecord(TypedDict, total=False): Cloudflare. """ + settings: SRVRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -795,6 +1129,24 @@ class SRVRecordData(TypedDict, total=False): """The record weight.""" +class SRVRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SSHFPRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -817,6 +1169,9 @@ class SSHFPRecord(TypedDict, total=False): Cloudflare. """ + settings: SSHFPRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -842,6 +1197,24 @@ class SSHFPRecordData(TypedDict, total=False): """type.""" +class SSHFPRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SVCBRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -864,6 +1237,9 @@ class SVCBRecord(TypedDict, total=False): Cloudflare. """ + settings: SVCBRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -889,6 +1265,24 @@ class SVCBRecordData(TypedDict, total=False): """value.""" +class SVCBRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class TLSARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -911,6 +1305,9 @@ class TLSARecord(TypedDict, total=False): Cloudflare. """ + settings: TLSARecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -939,6 +1336,24 @@ class TLSARecordData(TypedDict, total=False): """Usage.""" +class TLSARecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class TXTRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -969,6 +1384,9 @@ class TXTRecord(TypedDict, total=False): Cloudflare. """ + settings: TXTRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -983,6 +1401,24 @@ class TXTRecord(TypedDict, total=False): """Record type.""" +class TXTRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class URIRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -1011,6 +1447,9 @@ class URIRecord(TypedDict, total=False): Cloudflare. """ + settings: URIRecordSettings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" @@ -1033,6 +1472,24 @@ class URIRecordData(TypedDict, total=False): """The record weight.""" +class URIRecordSettings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + RecordUpdateParams: TypeAlias = Union[ ARecord, AAAARecord, diff --git a/src/cloudflare/types/dns/record_update_response.py b/src/cloudflare/types/dns/record_update_response.py deleted file mode 100644 index 342d44349d1..00000000000 --- a/src/cloudflare/types/dns/record_update_response.py +++ /dev/null @@ -1,595 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from . import ( - a_record, - ds_record, - mx_record, - ns_record, - caa_record, - loc_record, - ptr_record, - srv_record, - txt_record, - uri_record, - aaaa_record, - cert_record, - svcb_record, - tlsa_record, - cname_record, - https_record, - naptr_record, - sshfp_record, - dnskey_record, - smimea_record, -) -from .ttl import TTL -from ..._models import BaseModel -from .record_tags import RecordTags - -__all__ = [ - "RecordUpdateResponse", - "ARecord", - "AAAARecord", - "CAARecord", - "CERTRecord", - "CNAMERecord", - "DNSKEYRecord", - "DSRecord", - "HTTPSRecord", - "LOCRecord", - "MXRecord", - "NAPTRRecord", - "NSRecord", - "OpenpgpkeyRecord", - "PTRRecord", - "SMIMEARecord", - "SRVRecord", - "SSHFPRecord", - "SVCBRecord", - "TLSARecord", - "TXTRecord", - "URIRecord", -] - - -class ARecord(a_record.ARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class AAAARecord(aaaa_record.AAAARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class CAARecord(caa_record.CAARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class CERTRecord(cert_record.CERTRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class CNAMERecord(cname_record.CNAMERecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DNSKEYRecord(dnskey_record.DNSKEYRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class DSRecord(ds_record.DSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class HTTPSRecord(https_record.HTTPSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class LOCRecord(loc_record.LOCRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class MXRecord(mx_record.MXRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class NAPTRRecord(naptr_record.NAPTRRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class NSRecord(ns_record.NSRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class OpenpgpkeyRecord(BaseModel): - id: str - """Identifier""" - - comment: str - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: str - """A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1)""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - proxied: bool - """ - Whether the record is receiving the performance and security benefits of - Cloudflare. - """ - - tags: List[RecordTags] - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: TTL - """Time To Live (TTL) of the DNS record in seconds. - - Setting to 1 means 'automatic'. Value must be between 60 and 86400, with the - minimum reduced to 30 for Enterprise zones. - """ - - type: Literal["OPENPGPKEY"] - """Record type.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class PTRRecord(ptr_record.PTRRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class SMIMEARecord(smimea_record.SMIMEARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class SRVRecord(srv_record.SRVRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class SSHFPRecord(sshfp_record.SSHFPRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class SVCBRecord(svcb_record.SVCBRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class TLSARecord(tlsa_record.TLSARecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class TXTRecord(txt_record.TXTRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -class URIRecord(uri_record.URIRecord): - id: str - """Identifier""" - - created_on: datetime - """When the record was created.""" - - meta: object - """Extra Cloudflare-specific information about the record.""" - - modified_on: datetime - """When the record was last modified.""" - - proxiable: bool - """Whether the record can be proxied by Cloudflare or not.""" - - comment_modified_on: Optional[datetime] = None - """When the record comment was last modified. Omitted if there is no comment.""" - - tags_modified_on: Optional[datetime] = None - """When the record tags were last modified. Omitted if there are no tags.""" - - -RecordUpdateResponse: TypeAlias = Union[ - ARecord, - AAAARecord, - CAARecord, - CERTRecord, - CNAMERecord, - DNSKEYRecord, - DSRecord, - HTTPSRecord, - LOCRecord, - MXRecord, - NAPTRRecord, - NSRecord, - OpenpgpkeyRecord, - PTRRecord, - SMIMEARecord, - SRVRecord, - SSHFPRecord, - SVCBRecord, - TLSARecord, - TXTRecord, - URIRecord, -] diff --git a/src/cloudflare/types/dns/smimea_record.py b/src/cloudflare/types/dns/smimea_record.py index 7fae716400b..7dc5ddbe673 100644 --- a/src/cloudflare/types/dns/smimea_record.py +++ b/src/cloudflare/types/dns/smimea_record.py @@ -7,7 +7,7 @@ from ..._models import BaseModel from .record_tags import RecordTags -__all__ = ["SMIMEARecord", "Data"] +__all__ = ["SMIMEARecord", "Data", "Settings"] class Data(BaseModel): @@ -24,6 +24,24 @@ class Data(BaseModel): """Usage.""" +class Settings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SMIMEARecord(BaseModel): comment: Optional[str] = None """Comments or notes about the DNS record. @@ -46,6 +64,9 @@ class SMIMEARecord(BaseModel): Cloudflare. """ + settings: Optional[Settings] = None + """Settings for the DNS record.""" + tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/smimea_record_param.py b/src/cloudflare/types/dns/smimea_record_param.py index ce121a41674..45fb99c8700 100644 --- a/src/cloudflare/types/dns/smimea_record_param.py +++ b/src/cloudflare/types/dns/smimea_record_param.py @@ -8,7 +8,7 @@ from .ttl_param import TTLParam from .record_tags import RecordTags -__all__ = ["SMIMEARecordParam", "Data"] +__all__ = ["SMIMEARecordParam", "Data", "Settings"] class Data(TypedDict, total=False): @@ -25,6 +25,24 @@ class Data(TypedDict, total=False): """Usage.""" +class Settings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SMIMEARecordParam(TypedDict, total=False): comment: str """Comments or notes about the DNS record. @@ -44,6 +62,9 @@ class SMIMEARecordParam(TypedDict, total=False): Cloudflare. """ + settings: Settings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/srv_record.py b/src/cloudflare/types/dns/srv_record.py index 5be06e73406..add58ecb3c5 100644 --- a/src/cloudflare/types/dns/srv_record.py +++ b/src/cloudflare/types/dns/srv_record.py @@ -7,7 +7,7 @@ from ..._models import BaseModel from .record_tags import RecordTags -__all__ = ["SRVRecord", "Data"] +__all__ = ["SRVRecord", "Data", "Settings"] class Data(BaseModel): @@ -27,6 +27,24 @@ class Data(BaseModel): """The record weight.""" +class Settings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SRVRecord(BaseModel): comment: Optional[str] = None """Comments or notes about the DNS record. @@ -52,6 +70,9 @@ class SRVRecord(BaseModel): Cloudflare. """ + settings: Optional[Settings] = None + """Settings for the DNS record.""" + tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/srv_record_param.py b/src/cloudflare/types/dns/srv_record_param.py index 69812aa320e..a451de23711 100644 --- a/src/cloudflare/types/dns/srv_record_param.py +++ b/src/cloudflare/types/dns/srv_record_param.py @@ -8,7 +8,7 @@ from .ttl_param import TTLParam from .record_tags import RecordTags -__all__ = ["SRVRecordParam", "Data"] +__all__ = ["SRVRecordParam", "Data", "Settings"] class Data(TypedDict, total=False): @@ -28,6 +28,24 @@ class Data(TypedDict, total=False): """The record weight.""" +class Settings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SRVRecordParam(TypedDict, total=False): comment: str """Comments or notes about the DNS record. @@ -47,6 +65,9 @@ class SRVRecordParam(TypedDict, total=False): Cloudflare. """ + settings: Settings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/sshfp_record.py b/src/cloudflare/types/dns/sshfp_record.py index 855c412d9c6..cc8082194a4 100644 --- a/src/cloudflare/types/dns/sshfp_record.py +++ b/src/cloudflare/types/dns/sshfp_record.py @@ -7,7 +7,7 @@ from ..._models import BaseModel from .record_tags import RecordTags -__all__ = ["SSHFPRecord", "Data"] +__all__ = ["SSHFPRecord", "Data", "Settings"] class Data(BaseModel): @@ -21,6 +21,24 @@ class Data(BaseModel): """type.""" +class Settings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SSHFPRecord(BaseModel): comment: Optional[str] = None """Comments or notes about the DNS record. @@ -43,6 +61,9 @@ class SSHFPRecord(BaseModel): Cloudflare. """ + settings: Optional[Settings] = None + """Settings for the DNS record.""" + tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/sshfp_record_param.py b/src/cloudflare/types/dns/sshfp_record_param.py index 90bced65ccd..1f76cd1426b 100644 --- a/src/cloudflare/types/dns/sshfp_record_param.py +++ b/src/cloudflare/types/dns/sshfp_record_param.py @@ -8,7 +8,7 @@ from .ttl_param import TTLParam from .record_tags import RecordTags -__all__ = ["SSHFPRecordParam", "Data"] +__all__ = ["SSHFPRecordParam", "Data", "Settings"] class Data(TypedDict, total=False): @@ -22,6 +22,24 @@ class Data(TypedDict, total=False): """type.""" +class Settings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SSHFPRecordParam(TypedDict, total=False): comment: str """Comments or notes about the DNS record. @@ -41,6 +59,9 @@ class SSHFPRecordParam(TypedDict, total=False): Cloudflare. """ + settings: Settings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/svcb_record.py b/src/cloudflare/types/dns/svcb_record.py index 57e4bfa4b62..9daf5db47e4 100644 --- a/src/cloudflare/types/dns/svcb_record.py +++ b/src/cloudflare/types/dns/svcb_record.py @@ -7,7 +7,7 @@ from ..._models import BaseModel from .record_tags import RecordTags -__all__ = ["SVCBRecord", "Data"] +__all__ = ["SVCBRecord", "Data", "Settings"] class Data(BaseModel): @@ -21,6 +21,24 @@ class Data(BaseModel): """value.""" +class Settings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SVCBRecord(BaseModel): comment: Optional[str] = None """Comments or notes about the DNS record. @@ -43,6 +61,9 @@ class SVCBRecord(BaseModel): Cloudflare. """ + settings: Optional[Settings] = None + """Settings for the DNS record.""" + tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/svcb_record_param.py b/src/cloudflare/types/dns/svcb_record_param.py index e96d13d1bf3..d82b6b1fa75 100644 --- a/src/cloudflare/types/dns/svcb_record_param.py +++ b/src/cloudflare/types/dns/svcb_record_param.py @@ -8,7 +8,7 @@ from .ttl_param import TTLParam from .record_tags import RecordTags -__all__ = ["SVCBRecordParam", "Data"] +__all__ = ["SVCBRecordParam", "Data", "Settings"] class Data(TypedDict, total=False): @@ -22,6 +22,24 @@ class Data(TypedDict, total=False): """value.""" +class Settings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class SVCBRecordParam(TypedDict, total=False): comment: str """Comments or notes about the DNS record. @@ -41,6 +59,9 @@ class SVCBRecordParam(TypedDict, total=False): Cloudflare. """ + settings: Settings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/tlsa_record.py b/src/cloudflare/types/dns/tlsa_record.py index a822b971be1..f87a2bf2e98 100644 --- a/src/cloudflare/types/dns/tlsa_record.py +++ b/src/cloudflare/types/dns/tlsa_record.py @@ -7,7 +7,7 @@ from ..._models import BaseModel from .record_tags import RecordTags -__all__ = ["TLSARecord", "Data"] +__all__ = ["TLSARecord", "Data", "Settings"] class Data(BaseModel): @@ -24,6 +24,24 @@ class Data(BaseModel): """Usage.""" +class Settings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class TLSARecord(BaseModel): comment: Optional[str] = None """Comments or notes about the DNS record. @@ -46,6 +64,9 @@ class TLSARecord(BaseModel): Cloudflare. """ + settings: Optional[Settings] = None + """Settings for the DNS record.""" + tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/tlsa_record_param.py b/src/cloudflare/types/dns/tlsa_record_param.py index 9ee66f2ec8d..8ccad170c08 100644 --- a/src/cloudflare/types/dns/tlsa_record_param.py +++ b/src/cloudflare/types/dns/tlsa_record_param.py @@ -8,7 +8,7 @@ from .ttl_param import TTLParam from .record_tags import RecordTags -__all__ = ["TLSARecordParam", "Data"] +__all__ = ["TLSARecordParam", "Data", "Settings"] class Data(TypedDict, total=False): @@ -25,6 +25,24 @@ class Data(TypedDict, total=False): """Usage.""" +class Settings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class TLSARecordParam(TypedDict, total=False): comment: str """Comments or notes about the DNS record. @@ -44,6 +62,9 @@ class TLSARecordParam(TypedDict, total=False): Cloudflare. """ + settings: Settings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/txt_record.py b/src/cloudflare/types/dns/txt_record.py index 065a97c8938..77e0cba8c67 100644 --- a/src/cloudflare/types/dns/txt_record.py +++ b/src/cloudflare/types/dns/txt_record.py @@ -7,7 +7,25 @@ from ..._models import BaseModel from .record_tags import RecordTags -__all__ = ["TXTRecord"] +__all__ = ["TXTRecord", "Settings"] + + +class Settings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ class TXTRecord(BaseModel): @@ -37,6 +55,9 @@ class TXTRecord(BaseModel): Cloudflare. """ + settings: Optional[Settings] = None + """Settings for the DNS record.""" + tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/txt_record_param.py b/src/cloudflare/types/dns/txt_record_param.py index 4395ac4bcee..b17a8385426 100644 --- a/src/cloudflare/types/dns/txt_record_param.py +++ b/src/cloudflare/types/dns/txt_record_param.py @@ -8,7 +8,25 @@ from .ttl_param import TTLParam from .record_tags import RecordTags -__all__ = ["TXTRecordParam"] +__all__ = ["TXTRecordParam", "Settings"] + + +class Settings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ class TXTRecordParam(TypedDict, total=False): @@ -38,6 +56,9 @@ class TXTRecordParam(TypedDict, total=False): Cloudflare. """ + settings: Settings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/uri_record.py b/src/cloudflare/types/dns/uri_record.py index b3d45461850..d281d0c6d28 100644 --- a/src/cloudflare/types/dns/uri_record.py +++ b/src/cloudflare/types/dns/uri_record.py @@ -7,7 +7,7 @@ from ..._models import BaseModel from .record_tags import RecordTags -__all__ = ["URIRecord", "Data"] +__all__ = ["URIRecord", "Data", "Settings"] class Data(BaseModel): @@ -18,6 +18,24 @@ class Data(BaseModel): """The record weight.""" +class Settings(BaseModel): + ipv4_only: Optional[bool] = None + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: Optional[bool] = None + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class URIRecord(BaseModel): comment: Optional[str] = None """Comments or notes about the DNS record. @@ -46,6 +64,9 @@ class URIRecord(BaseModel): Cloudflare. """ + settings: Optional[Settings] = None + """Settings for the DNS record.""" + tags: Optional[List[RecordTags]] = None """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/dns/uri_record_param.py b/src/cloudflare/types/dns/uri_record_param.py index 59aafdfd3bc..4995b415771 100644 --- a/src/cloudflare/types/dns/uri_record_param.py +++ b/src/cloudflare/types/dns/uri_record_param.py @@ -8,7 +8,7 @@ from .ttl_param import TTLParam from .record_tags import RecordTags -__all__ = ["URIRecordParam", "Data"] +__all__ = ["URIRecordParam", "Data", "Settings"] class Data(TypedDict, total=False): @@ -19,6 +19,24 @@ class Data(TypedDict, total=False): """The record weight.""" +class Settings(TypedDict, total=False): + ipv4_only: bool + """ + When enabled, only A records will be generated, and AAAA records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + ipv6_only: bool + """ + When enabled, only AAAA records will be generated, and A records will not be + created. This setting is intended for exceptional cases. Note that this option + only applies to proxied records and it has no effect on whether Cloudflare + communicates with the origin using IPv4 or IPv6. + """ + + class URIRecordParam(TypedDict, total=False): comment: str """Comments or notes about the DNS record. @@ -44,6 +62,9 @@ class URIRecordParam(TypedDict, total=False): Cloudflare. """ + settings: Settings + """Settings for the DNS record.""" + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" diff --git a/src/cloudflare/types/email_security/investigate/preview_create_response.py b/src/cloudflare/types/email_security/investigate/preview_create_response.py index decc493cddc..21d6b0ca34a 100644 --- a/src/cloudflare/types/email_security/investigate/preview_create_response.py +++ b/src/cloudflare/types/email_security/investigate/preview_create_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional from ...._models import BaseModel @@ -9,5 +8,4 @@ class PreviewCreateResponse(BaseModel): screenshot: str - - error: Optional[str] = None + """A base64 encoded PNG image of the email.""" diff --git a/src/cloudflare/types/email_security/settings/block_sender_create_params.py b/src/cloudflare/types/email_security/settings/block_sender_create_params.py index 1408cb0674c..dc5290d600f 100644 --- a/src/cloudflare/types/email_security/settings/block_sender_create_params.py +++ b/src/cloudflare/types/email_security/settings/block_sender_create_params.py @@ -2,13 +2,13 @@ from __future__ import annotations -from typing import Union, Iterable, Optional -from typing_extensions import Literal, Required, TypeAlias, TypedDict +from typing import Optional +from typing_extensions import Literal, Required, TypedDict -__all__ = ["BlockSenderCreateParams", "EmailSecurityCreateBlockedSender", "Variant1", "Variant1Body"] +__all__ = ["BlockSenderCreateParams"] -class EmailSecurityCreateBlockedSender(TypedDict, total=False): +class BlockSenderCreateParams(TypedDict, total=False): account_id: Required[str] """Account Identifier""" @@ -19,23 +19,3 @@ class EmailSecurityCreateBlockedSender(TypedDict, total=False): pattern_type: Required[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]] comments: Optional[str] - - -class Variant1(TypedDict, total=False): - account_id: Required[str] - """Account Identifier""" - - body: Required[Iterable[Variant1Body]] - - -class Variant1Body(TypedDict, total=False): - is_regex: Required[bool] - - pattern: Required[str] - - pattern_type: Required[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]] - - comments: Optional[str] - - -BlockSenderCreateParams: TypeAlias = Union[EmailSecurityCreateBlockedSender, Variant1] diff --git a/src/cloudflare/types/email_security/settings/block_sender_create_response.py b/src/cloudflare/types/email_security/settings/block_sender_create_response.py index b3e80c9195e..615755f8fd7 100644 --- a/src/cloudflare/types/email_security/settings/block_sender_create_response.py +++ b/src/cloudflare/types/email_security/settings/block_sender_create_response.py @@ -1,16 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import Optional from datetime import datetime -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal from ...._models import BaseModel -__all__ = ["BlockSenderCreateResponse", "EmailSecurityBlockedSender", "UnionMember1"] +__all__ = ["BlockSenderCreateResponse"] -class EmailSecurityBlockedSender(BaseModel): +class BlockSenderCreateResponse(BaseModel): id: int + """The unique identifier for the allow policy.""" created_at: datetime @@ -23,22 +24,3 @@ class EmailSecurityBlockedSender(BaseModel): pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"] comments: Optional[str] = None - - -class UnionMember1(BaseModel): - id: int - - created_at: datetime - - is_regex: bool - - last_modified: datetime - - pattern: str - - pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"] - - comments: Optional[str] = None - - -BlockSenderCreateResponse: TypeAlias = Union[EmailSecurityBlockedSender, List[UnionMember1]] diff --git a/src/cloudflare/types/email_security/settings/block_sender_delete_response.py b/src/cloudflare/types/email_security/settings/block_sender_delete_response.py index 2dac65de0e7..f19dbd8d807 100644 --- a/src/cloudflare/types/email_security/settings/block_sender_delete_response.py +++ b/src/cloudflare/types/email_security/settings/block_sender_delete_response.py @@ -8,3 +8,4 @@ class BlockSenderDeleteResponse(BaseModel): id: int + """The unique identifier for the allow policy.""" diff --git a/src/cloudflare/types/email_security/settings/block_sender_edit_response.py b/src/cloudflare/types/email_security/settings/block_sender_edit_response.py index 55252960899..764d9fd5dee 100644 --- a/src/cloudflare/types/email_security/settings/block_sender_edit_response.py +++ b/src/cloudflare/types/email_security/settings/block_sender_edit_response.py @@ -11,6 +11,7 @@ class BlockSenderEditResponse(BaseModel): id: int + """The unique identifier for the allow policy.""" created_at: datetime diff --git a/src/cloudflare/types/email_security/settings/block_sender_get_response.py b/src/cloudflare/types/email_security/settings/block_sender_get_response.py index 5ec8429d4b8..66f03f3e3f6 100644 --- a/src/cloudflare/types/email_security/settings/block_sender_get_response.py +++ b/src/cloudflare/types/email_security/settings/block_sender_get_response.py @@ -11,6 +11,7 @@ class BlockSenderGetResponse(BaseModel): id: int + """The unique identifier for the allow policy.""" created_at: datetime diff --git a/src/cloudflare/types/email_security/settings/block_sender_list_response.py b/src/cloudflare/types/email_security/settings/block_sender_list_response.py index 3b30e018736..497ae4dc93d 100644 --- a/src/cloudflare/types/email_security/settings/block_sender_list_response.py +++ b/src/cloudflare/types/email_security/settings/block_sender_list_response.py @@ -11,6 +11,7 @@ class BlockSenderListResponse(BaseModel): id: int + """The unique identifier for the allow policy.""" created_at: datetime diff --git a/src/cloudflare/types/email_security/settings/impersonation_registry_create_params.py b/src/cloudflare/types/email_security/settings/impersonation_registry_create_params.py index 6afe1e4ecc2..db25db7e746 100644 --- a/src/cloudflare/types/email_security/settings/impersonation_registry_create_params.py +++ b/src/cloudflare/types/email_security/settings/impersonation_registry_create_params.py @@ -2,13 +2,12 @@ from __future__ import annotations -from typing import Union, Iterable -from typing_extensions import Required, TypeAlias, TypedDict +from typing_extensions import Required, TypedDict -__all__ = ["ImpersonationRegistryCreateParams", "EmailSecurityCreateDisplayName", "Variant1", "Variant1Body"] +__all__ = ["ImpersonationRegistryCreateParams"] -class EmailSecurityCreateDisplayName(TypedDict, total=False): +class ImpersonationRegistryCreateParams(TypedDict, total=False): account_id: Required[str] """Account Identifier""" @@ -17,21 +16,3 @@ class EmailSecurityCreateDisplayName(TypedDict, total=False): is_email_regex: Required[bool] name: Required[str] - - -class Variant1(TypedDict, total=False): - account_id: Required[str] - """Account Identifier""" - - body: Required[Iterable[Variant1Body]] - - -class Variant1Body(TypedDict, total=False): - email: Required[str] - - is_email_regex: Required[bool] - - name: Required[str] - - -ImpersonationRegistryCreateParams: TypeAlias = Union[EmailSecurityCreateDisplayName, Variant1] diff --git a/src/cloudflare/types/email_security/settings/impersonation_registry_create_response.py b/src/cloudflare/types/email_security/settings/impersonation_registry_create_response.py index 9a6c685fde3..c0dd1f55354 100644 --- a/src/cloudflare/types/email_security/settings/impersonation_registry_create_response.py +++ b/src/cloudflare/types/email_security/settings/impersonation_registry_create_response.py @@ -1,42 +1,19 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import Optional from datetime import datetime -from typing_extensions import TypeAlias from ...._models import BaseModel -__all__ = ["ImpersonationRegistryCreateResponse", "EmailSecurityDisplayName", "UnionMember1"] +__all__ = ["ImpersonationRegistryCreateResponse"] -class EmailSecurityDisplayName(BaseModel): +class ImpersonationRegistryCreateResponse(BaseModel): id: int created_at: datetime - is_email_regex: bool - - last_modified: datetime - - name: str - - comments: Optional[str] = None - - directory_id: Optional[int] = None - - directory_node_id: Optional[int] = None - - email: Optional[str] = None - - external_directory_node_id: Optional[str] = None - - provenance: Optional[str] = None - - -class UnionMember1(BaseModel): - id: int - - created_at: datetime + email: str is_email_regex: bool @@ -50,11 +27,6 @@ class UnionMember1(BaseModel): directory_node_id: Optional[int] = None - email: Optional[str] = None - external_directory_node_id: Optional[str] = None provenance: Optional[str] = None - - -ImpersonationRegistryCreateResponse: TypeAlias = Union[EmailSecurityDisplayName, List[UnionMember1]] diff --git a/src/cloudflare/types/email_security/settings/impersonation_registry_edit_response.py b/src/cloudflare/types/email_security/settings/impersonation_registry_edit_response.py index 8555fe6e757..824a0946f7c 100644 --- a/src/cloudflare/types/email_security/settings/impersonation_registry_edit_response.py +++ b/src/cloudflare/types/email_security/settings/impersonation_registry_edit_response.py @@ -13,6 +13,8 @@ class ImpersonationRegistryEditResponse(BaseModel): created_at: datetime + email: str + is_email_regex: bool last_modified: datetime @@ -25,8 +27,6 @@ class ImpersonationRegistryEditResponse(BaseModel): directory_node_id: Optional[int] = None - email: Optional[str] = None - external_directory_node_id: Optional[str] = None provenance: Optional[str] = None diff --git a/src/cloudflare/types/email_security/settings/impersonation_registry_get_response.py b/src/cloudflare/types/email_security/settings/impersonation_registry_get_response.py index 2ffea2569d4..85a8ab50d71 100644 --- a/src/cloudflare/types/email_security/settings/impersonation_registry_get_response.py +++ b/src/cloudflare/types/email_security/settings/impersonation_registry_get_response.py @@ -13,6 +13,8 @@ class ImpersonationRegistryGetResponse(BaseModel): created_at: datetime + email: str + is_email_regex: bool last_modified: datetime @@ -25,8 +27,6 @@ class ImpersonationRegistryGetResponse(BaseModel): directory_node_id: Optional[int] = None - email: Optional[str] = None - external_directory_node_id: Optional[str] = None provenance: Optional[str] = None diff --git a/src/cloudflare/types/email_security/settings/impersonation_registry_list_response.py b/src/cloudflare/types/email_security/settings/impersonation_registry_list_response.py index d75829c8a05..800c8d4bfd7 100644 --- a/src/cloudflare/types/email_security/settings/impersonation_registry_list_response.py +++ b/src/cloudflare/types/email_security/settings/impersonation_registry_list_response.py @@ -13,6 +13,8 @@ class ImpersonationRegistryListResponse(BaseModel): created_at: datetime + email: str + is_email_regex: bool last_modified: datetime @@ -25,8 +27,6 @@ class ImpersonationRegistryListResponse(BaseModel): directory_node_id: Optional[int] = None - email: Optional[str] = None - external_directory_node_id: Optional[str] = None provenance: Optional[str] = None diff --git a/src/cloudflare/types/images/v1/variant_delete_response.py b/src/cloudflare/types/images/v1/variant_delete_response.py index 849e187534e..3b3a97038ec 100644 --- a/src/cloudflare/types/images/v1/variant_delete_response.py +++ b/src/cloudflare/types/images/v1/variant_delete_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["VariantDeleteResponse"] -VariantDeleteResponse: TypeAlias = Union[Optional[str], Optional[object]] +VariantDeleteResponse: TypeAlias = Union[str, object] diff --git a/src/cloudflare/types/images/v1_delete_response.py b/src/cloudflare/types/images/v1_delete_response.py index b616950e39c..0122c846f86 100644 --- a/src/cloudflare/types/images/v1_delete_response.py +++ b/src/cloudflare/types/images/v1_delete_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["V1DeleteResponse"] -V1DeleteResponse: TypeAlias = Union[Optional[str], Optional[object]] +V1DeleteResponse: TypeAlias = Union[str, object] diff --git a/src/cloudflare/types/logpush/__init__.py b/src/cloudflare/types/logpush/__init__.py index 2416eed9d38..8ae5b0ec652 100644 --- a/src/cloudflare/types/logpush/__init__.py +++ b/src/cloudflare/types/logpush/__init__.py @@ -19,3 +19,5 @@ from .ownership_validate_params import OwnershipValidateParams as OwnershipValidateParams from .validate_destination_params import ValidateDestinationParams as ValidateDestinationParams from .validate_destination_response import ValidateDestinationResponse as ValidateDestinationResponse +from .validate_destination_exists_params import ValidateDestinationExistsParams as ValidateDestinationExistsParams +from .validate_destination_exists_response import ValidateDestinationExistsResponse as ValidateDestinationExistsResponse diff --git a/src/cloudflare/types/logpush/job_update_params.py b/src/cloudflare/types/logpush/job_update_params.py index 857882c86bf..dda7f649121 100644 --- a/src/cloudflare/types/logpush/job_update_params.py +++ b/src/cloudflare/types/logpush/job_update_params.py @@ -79,6 +79,13 @@ class JobUpdateParams(TypedDict, total=False): available for jobs with `edge` as its kind. """ + name: Optional[str] + """Optional human readable job name. + + Not unique. Cloudflare suggests that you set this to a meaningful string, like + the domain name, to make it easier to identify your job. + """ + output_options: Optional[OutputOptionsParam] """The structured replacement for `logpull_options`. diff --git a/src/cloudflare/types/logpush/validate_destination_exists_params.py b/src/cloudflare/types/logpush/validate_destination_exists_params.py new file mode 100644 index 00000000000..a23ee805037 --- /dev/null +++ b/src/cloudflare/types/logpush/validate_destination_exists_params.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ValidateDestinationExistsParams"] + + +class ValidateDestinationExistsParams(TypedDict, total=False): + destination_conf: Required[str] + """Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + + Additional configuration parameters supported by the destination may be + included. + """ + + account_id: str + """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" + + zone_id: str + """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" diff --git a/src/cloudflare/types/logpush/validate_destination_exists_response.py b/src/cloudflare/types/logpush/validate_destination_exists_response.py new file mode 100644 index 00000000000..6a0d5189763 --- /dev/null +++ b/src/cloudflare/types/logpush/validate_destination_exists_response.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["ValidateDestinationExistsResponse"] + + +class ValidateDestinationExistsResponse(BaseModel): + exists: Optional[bool] = None diff --git a/src/cloudflare/types/logpush/validate_destination_response.py b/src/cloudflare/types/logpush/validate_destination_response.py index e7fe2fd5ea9..e47e8559eb0 100644 --- a/src/cloudflare/types/logpush/validate_destination_response.py +++ b/src/cloudflare/types/logpush/validate_destination_response.py @@ -8,4 +8,6 @@ class ValidateDestinationResponse(BaseModel): - exists: Optional[bool] = None + message: Optional[str] = None + + valid: Optional[bool] = None diff --git a/src/cloudflare/types/magic_transit/sites/acl.py b/src/cloudflare/types/magic_transit/sites/acl.py index 5565fc0f5c9..41429544d0f 100644 --- a/src/cloudflare/types/magic_transit/sites/acl.py +++ b/src/cloudflare/types/magic_transit/sites/acl.py @@ -32,3 +32,11 @@ class ACL(BaseModel): """The name of the ACL.""" protocols: Optional[List[AllowedProtocol]] = None + + unidirectional: Optional[bool] = None + """The desired traffic direction for this ACL policy. + + If set to "false", the policy will allow bidirectional traffic. If set to + "true", the policy will only allow traffic in one direction. If not included in + request, will default to false. + """ diff --git a/src/cloudflare/types/magic_transit/sites/acl_create_params.py b/src/cloudflare/types/magic_transit/sites/acl_create_params.py index 48b2d5f517b..c193c6d556c 100644 --- a/src/cloudflare/types/magic_transit/sites/acl_create_params.py +++ b/src/cloudflare/types/magic_transit/sites/acl_create_params.py @@ -34,3 +34,11 @@ class ACLCreateParams(TypedDict, total=False): """ protocols: List[AllowedProtocol] + + unidirectional: bool + """The desired traffic direction for this ACL policy. + + If set to "false", the policy will allow bidirectional traffic. If set to + "true", the policy will only allow traffic in one direction. If not included in + request, will default to false. + """ diff --git a/src/cloudflare/types/magic_transit/sites/acl_edit_params.py b/src/cloudflare/types/magic_transit/sites/acl_edit_params.py index 8a6c7b0f5c6..3280bbe53b2 100644 --- a/src/cloudflare/types/magic_transit/sites/acl_edit_params.py +++ b/src/cloudflare/types/magic_transit/sites/acl_edit_params.py @@ -37,3 +37,11 @@ class ACLEditParams(TypedDict, total=False): """The name of the ACL.""" protocols: List[AllowedProtocol] + + unidirectional: bool + """The desired traffic direction for this ACL policy. + + If set to "false", the policy will allow bidirectional traffic. If set to + "true", the policy will only allow traffic in one direction. If not included in + request, will default to false. + """ diff --git a/src/cloudflare/types/magic_transit/sites/acl_update_params.py b/src/cloudflare/types/magic_transit/sites/acl_update_params.py index 5abc70c2329..250ed85c126 100644 --- a/src/cloudflare/types/magic_transit/sites/acl_update_params.py +++ b/src/cloudflare/types/magic_transit/sites/acl_update_params.py @@ -37,3 +37,11 @@ class ACLUpdateParams(TypedDict, total=False): """The name of the ACL.""" protocols: List[AllowedProtocol] + + unidirectional: bool + """The desired traffic direction for this ACL policy. + + If set to "false", the policy will allow bidirectional traffic. If set to + "true", the policy will only allow traffic in one direction. If not included in + request, will default to false. + """ diff --git a/src/cloudflare/types/magic_transit/sites/wan.py b/src/cloudflare/types/magic_transit/sites/wan.py index 1148e9f087f..dc8378ae312 100644 --- a/src/cloudflare/types/magic_transit/sites/wan.py +++ b/src/cloudflare/types/magic_transit/sites/wan.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from typing_extensions import Literal from ...._models import BaseModel from .wan_static_addressing import WANStaticAddressing @@ -12,6 +13,12 @@ class WAN(BaseModel): id: Optional[str] = None """Identifier""" + health_check_rate: Optional[Literal["low", "mid", "high"]] = None + """Magic WAN health check rate for tunnels created on this link. + + The default value is `mid`. + """ + name: Optional[str] = None physport: Optional[int] = None diff --git a/src/cloudflare/types/managed_transforms/__init__.py b/src/cloudflare/types/managed_transforms/__init__.py index 09e75d9fc15..34117bfe591 100644 --- a/src/cloudflare/types/managed_transforms/__init__.py +++ b/src/cloudflare/types/managed_transforms/__init__.py @@ -2,8 +2,6 @@ from __future__ import annotations -from .request_model import RequestModel as RequestModel -from .request_model_param import RequestModelParam as RequestModelParam from .managed_transform_edit_params import ManagedTransformEditParams as ManagedTransformEditParams from .managed_transform_edit_response import ManagedTransformEditResponse as ManagedTransformEditResponse from .managed_transform_list_response import ManagedTransformListResponse as ManagedTransformListResponse diff --git a/src/cloudflare/types/managed_transforms/managed_transform_edit_params.py b/src/cloudflare/types/managed_transforms/managed_transform_edit_params.py index 3f45bc1e8ef..0d92ba91f8d 100644 --- a/src/cloudflare/types/managed_transforms/managed_transform_edit_params.py +++ b/src/cloudflare/types/managed_transforms/managed_transform_edit_params.py @@ -5,15 +5,31 @@ from typing import Iterable from typing_extensions import Required, TypedDict -from .request_model_param import RequestModelParam - -__all__ = ["ManagedTransformEditParams"] +__all__ = ["ManagedTransformEditParams", "ManagedRequestHeader", "ManagedResponseHeader"] class ManagedTransformEditParams(TypedDict, total=False): zone_id: Required[str] - """Identifier""" + """The unique ID of the zone.""" + + managed_request_headers: Required[Iterable[ManagedRequestHeader]] + """The list of Managed Request Transforms.""" + + managed_response_headers: Required[Iterable[ManagedResponseHeader]] + """The list of Managed Response Transforms.""" + + +class ManagedRequestHeader(TypedDict, total=False): + id: Required[str] + """The human-readable identifier of the Managed Transform.""" + + enabled: Required[bool] + """Whether the Managed Transform is enabled.""" + - managed_request_headers: Required[Iterable[RequestModelParam]] +class ManagedResponseHeader(TypedDict, total=False): + id: Required[str] + """The human-readable identifier of the Managed Transform.""" - managed_response_headers: Required[Iterable[RequestModelParam]] + enabled: Required[bool] + """Whether the Managed Transform is enabled.""" diff --git a/src/cloudflare/types/managed_transforms/managed_transform_edit_response.py b/src/cloudflare/types/managed_transforms/managed_transform_edit_response.py index 59fab379331..762945a848b 100644 --- a/src/cloudflare/types/managed_transforms/managed_transform_edit_response.py +++ b/src/cloudflare/types/managed_transforms/managed_transform_edit_response.py @@ -8,28 +8,42 @@ class ManagedRequestHeader(BaseModel): - id: Optional[str] = None - """Human-readable identifier of the Managed Transform.""" + id: str + """The human-readable identifier of the Managed Transform.""" - available: Optional[bool] = None - """When true, the Managed Transform is available in the current Cloudflare plan.""" + enabled: bool + """Whether the Managed Transform is enabled.""" - enabled: Optional[bool] = None - """When true, the Managed Transform is enabled.""" + has_conflict: bool + """ + Whether the Managed Transform conflicts with the currently-enabled Managed + Transforms. + """ + + conflicts_with: Optional[List[str]] = None + """The Managed Transforms that this Managed Transform conflicts with.""" class ManagedResponseHeader(BaseModel): - id: Optional[str] = None - """Human-readable identifier of the Managed Transform.""" + id: str + """The human-readable identifier of the Managed Transform.""" + + enabled: bool + """Whether the Managed Transform is enabled.""" - available: Optional[bool] = None - """When true, the Managed Transform is available in the current Cloudflare plan.""" + has_conflict: bool + """ + Whether the Managed Transform conflicts with the currently-enabled Managed + Transforms. + """ - enabled: Optional[bool] = None - """When true, the Managed Transform is enabled.""" + conflicts_with: Optional[List[str]] = None + """The Managed Transforms that this Managed Transform conflicts with.""" class ManagedTransformEditResponse(BaseModel): - managed_request_headers: Optional[List[ManagedRequestHeader]] = None + managed_request_headers: List[ManagedRequestHeader] + """The list of Managed Request Transforms.""" - managed_response_headers: Optional[List[ManagedResponseHeader]] = None + managed_response_headers: List[ManagedResponseHeader] + """The list of Managed Response Transforms.""" diff --git a/src/cloudflare/types/managed_transforms/managed_transform_list_response.py b/src/cloudflare/types/managed_transforms/managed_transform_list_response.py index dfc3ffc7171..c9c5f5c4af2 100644 --- a/src/cloudflare/types/managed_transforms/managed_transform_list_response.py +++ b/src/cloudflare/types/managed_transforms/managed_transform_list_response.py @@ -3,12 +3,47 @@ from typing import List, Optional from ..._models import BaseModel -from .request_model import RequestModel -__all__ = ["ManagedTransformListResponse"] +__all__ = ["ManagedTransformListResponse", "ManagedRequestHeader", "ManagedResponseHeader"] + + +class ManagedRequestHeader(BaseModel): + id: str + """The human-readable identifier of the Managed Transform.""" + + enabled: bool + """Whether the Managed Transform is enabled.""" + + has_conflict: bool + """ + Whether the Managed Transform conflicts with the currently-enabled Managed + Transforms. + """ + + conflicts_with: Optional[List[str]] = None + """The Managed Transforms that this Managed Transform conflicts with.""" + + +class ManagedResponseHeader(BaseModel): + id: str + """The human-readable identifier of the Managed Transform.""" + + enabled: bool + """Whether the Managed Transform is enabled.""" + + has_conflict: bool + """ + Whether the Managed Transform conflicts with the currently-enabled Managed + Transforms. + """ + + conflicts_with: Optional[List[str]] = None + """The Managed Transforms that this Managed Transform conflicts with.""" class ManagedTransformListResponse(BaseModel): - managed_request_headers: Optional[List[RequestModel]] = None + managed_request_headers: List[ManagedRequestHeader] + """The list of Managed Request Transforms.""" - managed_response_headers: Optional[List[RequestModel]] = None + managed_response_headers: List[ManagedResponseHeader] + """The list of Managed Response Transforms.""" diff --git a/src/cloudflare/types/managed_transforms/request_model.py b/src/cloudflare/types/managed_transforms/request_model.py deleted file mode 100644 index 281db0613d3..00000000000 --- a/src/cloudflare/types/managed_transforms/request_model.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["RequestModel"] - - -class RequestModel(BaseModel): - id: Optional[str] = None - """Human-readable identifier of the Managed Transform.""" - - enabled: Optional[bool] = None - """When true, the Managed Transform is enabled.""" diff --git a/src/cloudflare/types/managed_transforms/request_model_param.py b/src/cloudflare/types/managed_transforms/request_model_param.py deleted file mode 100644 index d207b5bf111..00000000000 --- a/src/cloudflare/types/managed_transforms/request_model_param.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["RequestModelParam"] - - -class RequestModelParam(TypedDict, total=False): - id: str - """Human-readable identifier of the Managed Transform.""" - - enabled: bool - """When true, the Managed Transform is enabled.""" diff --git a/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_get_response.py b/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_get_response.py index 6f1aa4dca49..160be05baa8 100644 --- a/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_get_response.py +++ b/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_get_response.py @@ -1,8 +1,23 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional -from typing_extensions import TypeAlias +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel __all__ = ["OriginPostQuantumEncryptionGetResponse"] -OriginPostQuantumEncryptionGetResponse: TypeAlias = Union[Optional[str], Optional[object]] + +class OriginPostQuantumEncryptionGetResponse(BaseModel): + id: Literal["origin_pqe"] + """Value of the zone setting.""" + + editable: bool + """Whether the setting is editable""" + + value: Literal["preferred", "supported", "off"] + """The value of the feature""" + + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_update_response.py b/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_update_response.py index bfc6dab7036..f2ec8775f16 100644 --- a/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_update_response.py +++ b/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_update_response.py @@ -1,8 +1,23 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional -from typing_extensions import TypeAlias +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel __all__ = ["OriginPostQuantumEncryptionUpdateResponse"] -OriginPostQuantumEncryptionUpdateResponse: TypeAlias = Union[Optional[str], Optional[object]] + +class OriginPostQuantumEncryptionUpdateResponse(BaseModel): + id: Literal["origin_pqe"] + """Value of the zone setting.""" + + editable: bool + """Whether the setting is editable""" + + value: Literal["preferred", "supported", "off"] + """The value of the feature""" + + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/page_rules/page_rule.py b/src/cloudflare/types/page_rules/page_rule.py index 3792ea151f9..64a7fa0508c 100644 --- a/src/cloudflare/types/page_rules/page_rule.py +++ b/src/cloudflare/types/page_rules/page_rule.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import Dict, List, Union, Optional from datetime import datetime from typing_extensions import Literal, Annotated, TypeAlias @@ -32,14 +32,15 @@ "ActionBypassCacheOnCookie", "ActionCacheByDeviceType", "ActionCacheDeceptionArmor", - "ActionCacheKey", - "ActionCacheKeyValue", - "ActionCacheKeyValueCookie", - "ActionCacheKeyValueHeader", - "ActionCacheKeyValueHost", - "ActionCacheKeyValueQueryString", - "ActionCacheKeyValueUser", + "ActionCacheKeyFields", + "ActionCacheKeyFieldsValue", + "ActionCacheKeyFieldsValueCookie", + "ActionCacheKeyFieldsValueHeader", + "ActionCacheKeyFieldsValueHost", + "ActionCacheKeyFieldsValueQueryString", + "ActionCacheKeyFieldsValueUser", "ActionCacheOnCookie", + "ActionCacheTTLByStatus", "ActionDisableApps", "ActionDisablePerformance", "ActionDisableSecurity", @@ -90,7 +91,7 @@ class ActionCacheDeceptionArmor(BaseModel): """The status of Cache Deception Armor.""" -class ActionCacheKeyValueCookie(BaseModel): +class ActionCacheKeyFieldsValueCookie(BaseModel): check_presence: Optional[List[str]] = None """ A list of cookies to check for the presence of, without including their actual @@ -101,7 +102,7 @@ class ActionCacheKeyValueCookie(BaseModel): """A list of cookies to include.""" -class ActionCacheKeyValueHeader(BaseModel): +class ActionCacheKeyFieldsValueHeader(BaseModel): check_presence: Optional[List[str]] = None """ A list of headers to check for the presence of, without including their actual @@ -115,12 +116,12 @@ class ActionCacheKeyValueHeader(BaseModel): """A list of headers to include.""" -class ActionCacheKeyValueHost(BaseModel): +class ActionCacheKeyFieldsValueHost(BaseModel): resolved: Optional[bool] = None """Whether to include the Host header in the HTTP request sent to the origin.""" -class ActionCacheKeyValueQueryString(BaseModel): +class ActionCacheKeyFieldsValueQueryString(BaseModel): exclude: Union[Literal["*"], List[str], None] = None """Ignore all query string parameters.""" @@ -128,7 +129,7 @@ class ActionCacheKeyValueQueryString(BaseModel): """Include all query string parameters.""" -class ActionCacheKeyValueUser(BaseModel): +class ActionCacheKeyFieldsValueUser(BaseModel): device_type: Optional[bool] = None """ Classifies a request as `mobile`, `desktop`, or `tablet` based on the User @@ -145,38 +146,38 @@ class ActionCacheKeyValueUser(BaseModel): """ -class ActionCacheKeyValue(BaseModel): - cookie: Optional[ActionCacheKeyValueCookie] = None +class ActionCacheKeyFieldsValue(BaseModel): + cookie: Optional[ActionCacheKeyFieldsValueCookie] = None """Controls which cookies appear in the Cache Key.""" - header: Optional[ActionCacheKeyValueHeader] = None + header: Optional[ActionCacheKeyFieldsValueHeader] = None """Controls which headers go into the Cache Key. Exactly one of `include` or `exclude` is expected. """ - host: Optional[ActionCacheKeyValueHost] = None + host: Optional[ActionCacheKeyFieldsValueHost] = None """Determines which host header to include in the Cache Key.""" - query_string: Optional[ActionCacheKeyValueQueryString] = None + query_string: Optional[ActionCacheKeyFieldsValueQueryString] = None """Controls which URL query string parameters go into the Cache Key. Exactly one of `include` or `exclude` is expected. """ - user: Optional[ActionCacheKeyValueUser] = None + user: Optional[ActionCacheKeyFieldsValueUser] = None """Feature fields to add features about the end-user (client) into the Cache Key.""" -class ActionCacheKey(BaseModel): - id: Optional[Literal["cache_key"]] = None +class ActionCacheKeyFields(BaseModel): + id: Optional[Literal["cache_key_fields"]] = None """ Control specifically what variables to include when deciding which resources to cache. This allows customers to determine what to cache based on something other than just the URL. """ - value: Optional[ActionCacheKeyValue] = None + value: Optional[ActionCacheKeyFieldsValue] = None class ActionCacheOnCookie(BaseModel): @@ -190,6 +191,36 @@ class ActionCacheOnCookie(BaseModel): """The regular expression to use for matching cookie names in the request.""" +class ActionCacheTTLByStatus(BaseModel): + id: Optional[Literal["cache_ttl_by_status"]] = None + """ + Enterprise customers can set cache time-to-live (TTL) based on the response + status from the origin web server. Cache TTL refers to the duration of a + resource in the Cloudflare network before being marked as stale or discarded + from cache. Status codes are returned by a resource's origin. Setting cache TTL + based on response status overrides the default cache behavior (standard caching) + for static files and overrides cache instructions sent by the origin web server. + To cache non-static assets, set a Cache Level of Cache Everything using a Page + Rule. Setting no-store Cache-Control or a low TTL (using `max-age`/`s-maxage`) + increases requests to origin web servers and decreases performance. + """ + + value: Optional[Dict[str, Union[Literal["no-cache", "no-store"], int]]] = None + """ + A JSON object containing status codes and their corresponding TTLs. Each + key-value pair in the cache TTL by status cache rule has the following syntax + + - `status_code`: An integer value such as 200 or 500. status_code matches the + exact status code from the origin web server. Valid status codes are between + 100-999. + - `status_code_range`: Integer values for from and to. status_code_range matches + any status code from the origin web server within the specified range. + - `value`: An integer value that defines the duration an asset is valid in + seconds or one of the following strings: no-store (equivalent to -1), no-cache + (equivalent to 0). + """ + + class ActionDisableApps(BaseModel): id: Optional[Literal["disable_apps"]] = None """ @@ -309,9 +340,10 @@ class ActionRespectStrongEtag(BaseModel): ActionBypassCacheOnCookie, ActionCacheByDeviceType, ActionCacheDeceptionArmor, - ActionCacheKey, + ActionCacheKeyFields, CacheLevel, ActionCacheOnCookie, + ActionCacheTTLByStatus, ActionDisableApps, ActionDisablePerformance, ActionDisableSecurity, diff --git a/src/cloudflare/types/page_rules/page_rule_create_params.py b/src/cloudflare/types/page_rules/page_rule_create_params.py index 7a3dbc4fcf9..9a137919711 100644 --- a/src/cloudflare/types/page_rules/page_rule_create_params.py +++ b/src/cloudflare/types/page_rules/page_rule_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Union, Iterable +from typing import Dict, List, Union, Iterable from typing_extensions import Literal, Required, TypeAlias, TypedDict from .target_param import TargetParam @@ -31,14 +31,15 @@ "ActionBypassCacheOnCookie", "ActionCacheByDeviceType", "ActionCacheDeceptionArmor", - "ActionCacheKey", - "ActionCacheKeyValue", - "ActionCacheKeyValueCookie", - "ActionCacheKeyValueHeader", - "ActionCacheKeyValueHost", - "ActionCacheKeyValueQueryString", - "ActionCacheKeyValueUser", + "ActionCacheKeyFields", + "ActionCacheKeyFieldsValue", + "ActionCacheKeyFieldsValueCookie", + "ActionCacheKeyFieldsValueHeader", + "ActionCacheKeyFieldsValueHost", + "ActionCacheKeyFieldsValueQueryString", + "ActionCacheKeyFieldsValueUser", "ActionCacheOnCookie", + "ActionCacheTTLByStatus", "ActionDisableApps", "ActionDisablePerformance", "ActionDisableSecurity", @@ -115,7 +116,7 @@ class ActionCacheDeceptionArmor(TypedDict, total=False): """The status of Cache Deception Armor.""" -class ActionCacheKeyValueCookie(TypedDict, total=False): +class ActionCacheKeyFieldsValueCookie(TypedDict, total=False): check_presence: List[str] """ A list of cookies to check for the presence of, without including their actual @@ -126,7 +127,7 @@ class ActionCacheKeyValueCookie(TypedDict, total=False): """A list of cookies to include.""" -class ActionCacheKeyValueHeader(TypedDict, total=False): +class ActionCacheKeyFieldsValueHeader(TypedDict, total=False): check_presence: List[str] """ A list of headers to check for the presence of, without including their actual @@ -140,12 +141,12 @@ class ActionCacheKeyValueHeader(TypedDict, total=False): """A list of headers to include.""" -class ActionCacheKeyValueHost(TypedDict, total=False): +class ActionCacheKeyFieldsValueHost(TypedDict, total=False): resolved: bool """Whether to include the Host header in the HTTP request sent to the origin.""" -class ActionCacheKeyValueQueryString(TypedDict, total=False): +class ActionCacheKeyFieldsValueQueryString(TypedDict, total=False): exclude: Union[Literal["*"], List[str]] """Ignore all query string parameters.""" @@ -153,7 +154,7 @@ class ActionCacheKeyValueQueryString(TypedDict, total=False): """Include all query string parameters.""" -class ActionCacheKeyValueUser(TypedDict, total=False): +class ActionCacheKeyFieldsValueUser(TypedDict, total=False): device_type: bool """ Classifies a request as `mobile`, `desktop`, or `tablet` based on the User @@ -170,38 +171,38 @@ class ActionCacheKeyValueUser(TypedDict, total=False): """ -class ActionCacheKeyValue(TypedDict, total=False): - cookie: ActionCacheKeyValueCookie +class ActionCacheKeyFieldsValue(TypedDict, total=False): + cookie: ActionCacheKeyFieldsValueCookie """Controls which cookies appear in the Cache Key.""" - header: ActionCacheKeyValueHeader + header: ActionCacheKeyFieldsValueHeader """Controls which headers go into the Cache Key. Exactly one of `include` or `exclude` is expected. """ - host: ActionCacheKeyValueHost + host: ActionCacheKeyFieldsValueHost """Determines which host header to include in the Cache Key.""" - query_string: ActionCacheKeyValueQueryString + query_string: ActionCacheKeyFieldsValueQueryString """Controls which URL query string parameters go into the Cache Key. Exactly one of `include` or `exclude` is expected. """ - user: ActionCacheKeyValueUser + user: ActionCacheKeyFieldsValueUser """Feature fields to add features about the end-user (client) into the Cache Key.""" -class ActionCacheKey(TypedDict, total=False): - id: Literal["cache_key"] +class ActionCacheKeyFields(TypedDict, total=False): + id: Literal["cache_key_fields"] """ Control specifically what variables to include when deciding which resources to cache. This allows customers to determine what to cache based on something other than just the URL. """ - value: ActionCacheKeyValue + value: ActionCacheKeyFieldsValue class ActionCacheOnCookie(TypedDict, total=False): @@ -215,6 +216,36 @@ class ActionCacheOnCookie(TypedDict, total=False): """The regular expression to use for matching cookie names in the request.""" +class ActionCacheTTLByStatus(TypedDict, total=False): + id: Literal["cache_ttl_by_status"] + """ + Enterprise customers can set cache time-to-live (TTL) based on the response + status from the origin web server. Cache TTL refers to the duration of a + resource in the Cloudflare network before being marked as stale or discarded + from cache. Status codes are returned by a resource's origin. Setting cache TTL + based on response status overrides the default cache behavior (standard caching) + for static files and overrides cache instructions sent by the origin web server. + To cache non-static assets, set a Cache Level of Cache Everything using a Page + Rule. Setting no-store Cache-Control or a low TTL (using `max-age`/`s-maxage`) + increases requests to origin web servers and decreases performance. + """ + + value: Dict[str, Union[Literal["no-cache", "no-store"], int]] + """ + A JSON object containing status codes and their corresponding TTLs. Each + key-value pair in the cache TTL by status cache rule has the following syntax + + - `status_code`: An integer value such as 200 or 500. status_code matches the + exact status code from the origin web server. Valid status codes are between + 100-999. + - `status_code_range`: Integer values for from and to. status_code_range matches + any status code from the origin web server within the specified range. + - `value`: An integer value that defines the duration an asset is valid in + seconds or one of the following strings: no-store (equivalent to -1), no-cache + (equivalent to 0). + """ + + class ActionDisableApps(TypedDict, total=False): id: Literal["disable_apps"] """ @@ -333,9 +364,10 @@ class ActionRespectStrongEtag(TypedDict, total=False): ActionBypassCacheOnCookie, ActionCacheByDeviceType, ActionCacheDeceptionArmor, - ActionCacheKey, + ActionCacheKeyFields, CacheLevelParam, ActionCacheOnCookie, + ActionCacheTTLByStatus, ActionDisableApps, ActionDisablePerformance, ActionDisableSecurity, diff --git a/src/cloudflare/types/page_rules/page_rule_edit_params.py b/src/cloudflare/types/page_rules/page_rule_edit_params.py index fe7c599ea02..ea3b103842d 100644 --- a/src/cloudflare/types/page_rules/page_rule_edit_params.py +++ b/src/cloudflare/types/page_rules/page_rule_edit_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Union, Iterable +from typing import Dict, List, Union, Iterable from typing_extensions import Literal, Required, TypeAlias, TypedDict from .target_param import TargetParam @@ -31,14 +31,15 @@ "ActionBypassCacheOnCookie", "ActionCacheByDeviceType", "ActionCacheDeceptionArmor", - "ActionCacheKey", - "ActionCacheKeyValue", - "ActionCacheKeyValueCookie", - "ActionCacheKeyValueHeader", - "ActionCacheKeyValueHost", - "ActionCacheKeyValueQueryString", - "ActionCacheKeyValueUser", + "ActionCacheKeyFields", + "ActionCacheKeyFieldsValue", + "ActionCacheKeyFieldsValueCookie", + "ActionCacheKeyFieldsValueHeader", + "ActionCacheKeyFieldsValueHost", + "ActionCacheKeyFieldsValueQueryString", + "ActionCacheKeyFieldsValueUser", "ActionCacheOnCookie", + "ActionCacheTTLByStatus", "ActionDisableApps", "ActionDisablePerformance", "ActionDisableSecurity", @@ -115,7 +116,7 @@ class ActionCacheDeceptionArmor(TypedDict, total=False): """The status of Cache Deception Armor.""" -class ActionCacheKeyValueCookie(TypedDict, total=False): +class ActionCacheKeyFieldsValueCookie(TypedDict, total=False): check_presence: List[str] """ A list of cookies to check for the presence of, without including their actual @@ -126,7 +127,7 @@ class ActionCacheKeyValueCookie(TypedDict, total=False): """A list of cookies to include.""" -class ActionCacheKeyValueHeader(TypedDict, total=False): +class ActionCacheKeyFieldsValueHeader(TypedDict, total=False): check_presence: List[str] """ A list of headers to check for the presence of, without including their actual @@ -140,12 +141,12 @@ class ActionCacheKeyValueHeader(TypedDict, total=False): """A list of headers to include.""" -class ActionCacheKeyValueHost(TypedDict, total=False): +class ActionCacheKeyFieldsValueHost(TypedDict, total=False): resolved: bool """Whether to include the Host header in the HTTP request sent to the origin.""" -class ActionCacheKeyValueQueryString(TypedDict, total=False): +class ActionCacheKeyFieldsValueQueryString(TypedDict, total=False): exclude: Union[Literal["*"], List[str]] """Ignore all query string parameters.""" @@ -153,7 +154,7 @@ class ActionCacheKeyValueQueryString(TypedDict, total=False): """Include all query string parameters.""" -class ActionCacheKeyValueUser(TypedDict, total=False): +class ActionCacheKeyFieldsValueUser(TypedDict, total=False): device_type: bool """ Classifies a request as `mobile`, `desktop`, or `tablet` based on the User @@ -170,38 +171,38 @@ class ActionCacheKeyValueUser(TypedDict, total=False): """ -class ActionCacheKeyValue(TypedDict, total=False): - cookie: ActionCacheKeyValueCookie +class ActionCacheKeyFieldsValue(TypedDict, total=False): + cookie: ActionCacheKeyFieldsValueCookie """Controls which cookies appear in the Cache Key.""" - header: ActionCacheKeyValueHeader + header: ActionCacheKeyFieldsValueHeader """Controls which headers go into the Cache Key. Exactly one of `include` or `exclude` is expected. """ - host: ActionCacheKeyValueHost + host: ActionCacheKeyFieldsValueHost """Determines which host header to include in the Cache Key.""" - query_string: ActionCacheKeyValueQueryString + query_string: ActionCacheKeyFieldsValueQueryString """Controls which URL query string parameters go into the Cache Key. Exactly one of `include` or `exclude` is expected. """ - user: ActionCacheKeyValueUser + user: ActionCacheKeyFieldsValueUser """Feature fields to add features about the end-user (client) into the Cache Key.""" -class ActionCacheKey(TypedDict, total=False): - id: Literal["cache_key"] +class ActionCacheKeyFields(TypedDict, total=False): + id: Literal["cache_key_fields"] """ Control specifically what variables to include when deciding which resources to cache. This allows customers to determine what to cache based on something other than just the URL. """ - value: ActionCacheKeyValue + value: ActionCacheKeyFieldsValue class ActionCacheOnCookie(TypedDict, total=False): @@ -215,6 +216,36 @@ class ActionCacheOnCookie(TypedDict, total=False): """The regular expression to use for matching cookie names in the request.""" +class ActionCacheTTLByStatus(TypedDict, total=False): + id: Literal["cache_ttl_by_status"] + """ + Enterprise customers can set cache time-to-live (TTL) based on the response + status from the origin web server. Cache TTL refers to the duration of a + resource in the Cloudflare network before being marked as stale or discarded + from cache. Status codes are returned by a resource's origin. Setting cache TTL + based on response status overrides the default cache behavior (standard caching) + for static files and overrides cache instructions sent by the origin web server. + To cache non-static assets, set a Cache Level of Cache Everything using a Page + Rule. Setting no-store Cache-Control or a low TTL (using `max-age`/`s-maxage`) + increases requests to origin web servers and decreases performance. + """ + + value: Dict[str, Union[Literal["no-cache", "no-store"], int]] + """ + A JSON object containing status codes and their corresponding TTLs. Each + key-value pair in the cache TTL by status cache rule has the following syntax + + - `status_code`: An integer value such as 200 or 500. status_code matches the + exact status code from the origin web server. Valid status codes are between + 100-999. + - `status_code_range`: Integer values for from and to. status_code_range matches + any status code from the origin web server within the specified range. + - `value`: An integer value that defines the duration an asset is valid in + seconds or one of the following strings: no-store (equivalent to -1), no-cache + (equivalent to 0). + """ + + class ActionDisableApps(TypedDict, total=False): id: Literal["disable_apps"] """ @@ -333,9 +364,10 @@ class ActionRespectStrongEtag(TypedDict, total=False): ActionBypassCacheOnCookie, ActionCacheByDeviceType, ActionCacheDeceptionArmor, - ActionCacheKey, + ActionCacheKeyFields, CacheLevelParam, ActionCacheOnCookie, + ActionCacheTTLByStatus, ActionDisableApps, ActionDisablePerformance, ActionDisableSecurity, diff --git a/src/cloudflare/types/page_rules/page_rule_update_params.py b/src/cloudflare/types/page_rules/page_rule_update_params.py index ceff13a48fe..9328f0540b8 100644 --- a/src/cloudflare/types/page_rules/page_rule_update_params.py +++ b/src/cloudflare/types/page_rules/page_rule_update_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Union, Iterable +from typing import Dict, List, Union, Iterable from typing_extensions import Literal, Required, TypeAlias, TypedDict from .target_param import TargetParam @@ -31,14 +31,15 @@ "ActionBypassCacheOnCookie", "ActionCacheByDeviceType", "ActionCacheDeceptionArmor", - "ActionCacheKey", - "ActionCacheKeyValue", - "ActionCacheKeyValueCookie", - "ActionCacheKeyValueHeader", - "ActionCacheKeyValueHost", - "ActionCacheKeyValueQueryString", - "ActionCacheKeyValueUser", + "ActionCacheKeyFields", + "ActionCacheKeyFieldsValue", + "ActionCacheKeyFieldsValueCookie", + "ActionCacheKeyFieldsValueHeader", + "ActionCacheKeyFieldsValueHost", + "ActionCacheKeyFieldsValueQueryString", + "ActionCacheKeyFieldsValueUser", "ActionCacheOnCookie", + "ActionCacheTTLByStatus", "ActionDisableApps", "ActionDisablePerformance", "ActionDisableSecurity", @@ -115,7 +116,7 @@ class ActionCacheDeceptionArmor(TypedDict, total=False): """The status of Cache Deception Armor.""" -class ActionCacheKeyValueCookie(TypedDict, total=False): +class ActionCacheKeyFieldsValueCookie(TypedDict, total=False): check_presence: List[str] """ A list of cookies to check for the presence of, without including their actual @@ -126,7 +127,7 @@ class ActionCacheKeyValueCookie(TypedDict, total=False): """A list of cookies to include.""" -class ActionCacheKeyValueHeader(TypedDict, total=False): +class ActionCacheKeyFieldsValueHeader(TypedDict, total=False): check_presence: List[str] """ A list of headers to check for the presence of, without including their actual @@ -140,12 +141,12 @@ class ActionCacheKeyValueHeader(TypedDict, total=False): """A list of headers to include.""" -class ActionCacheKeyValueHost(TypedDict, total=False): +class ActionCacheKeyFieldsValueHost(TypedDict, total=False): resolved: bool """Whether to include the Host header in the HTTP request sent to the origin.""" -class ActionCacheKeyValueQueryString(TypedDict, total=False): +class ActionCacheKeyFieldsValueQueryString(TypedDict, total=False): exclude: Union[Literal["*"], List[str]] """Ignore all query string parameters.""" @@ -153,7 +154,7 @@ class ActionCacheKeyValueQueryString(TypedDict, total=False): """Include all query string parameters.""" -class ActionCacheKeyValueUser(TypedDict, total=False): +class ActionCacheKeyFieldsValueUser(TypedDict, total=False): device_type: bool """ Classifies a request as `mobile`, `desktop`, or `tablet` based on the User @@ -170,38 +171,38 @@ class ActionCacheKeyValueUser(TypedDict, total=False): """ -class ActionCacheKeyValue(TypedDict, total=False): - cookie: ActionCacheKeyValueCookie +class ActionCacheKeyFieldsValue(TypedDict, total=False): + cookie: ActionCacheKeyFieldsValueCookie """Controls which cookies appear in the Cache Key.""" - header: ActionCacheKeyValueHeader + header: ActionCacheKeyFieldsValueHeader """Controls which headers go into the Cache Key. Exactly one of `include` or `exclude` is expected. """ - host: ActionCacheKeyValueHost + host: ActionCacheKeyFieldsValueHost """Determines which host header to include in the Cache Key.""" - query_string: ActionCacheKeyValueQueryString + query_string: ActionCacheKeyFieldsValueQueryString """Controls which URL query string parameters go into the Cache Key. Exactly one of `include` or `exclude` is expected. """ - user: ActionCacheKeyValueUser + user: ActionCacheKeyFieldsValueUser """Feature fields to add features about the end-user (client) into the Cache Key.""" -class ActionCacheKey(TypedDict, total=False): - id: Literal["cache_key"] +class ActionCacheKeyFields(TypedDict, total=False): + id: Literal["cache_key_fields"] """ Control specifically what variables to include when deciding which resources to cache. This allows customers to determine what to cache based on something other than just the URL. """ - value: ActionCacheKeyValue + value: ActionCacheKeyFieldsValue class ActionCacheOnCookie(TypedDict, total=False): @@ -215,6 +216,36 @@ class ActionCacheOnCookie(TypedDict, total=False): """The regular expression to use for matching cookie names in the request.""" +class ActionCacheTTLByStatus(TypedDict, total=False): + id: Literal["cache_ttl_by_status"] + """ + Enterprise customers can set cache time-to-live (TTL) based on the response + status from the origin web server. Cache TTL refers to the duration of a + resource in the Cloudflare network before being marked as stale or discarded + from cache. Status codes are returned by a resource's origin. Setting cache TTL + based on response status overrides the default cache behavior (standard caching) + for static files and overrides cache instructions sent by the origin web server. + To cache non-static assets, set a Cache Level of Cache Everything using a Page + Rule. Setting no-store Cache-Control or a low TTL (using `max-age`/`s-maxage`) + increases requests to origin web servers and decreases performance. + """ + + value: Dict[str, Union[Literal["no-cache", "no-store"], int]] + """ + A JSON object containing status codes and their corresponding TTLs. Each + key-value pair in the cache TTL by status cache rule has the following syntax + + - `status_code`: An integer value such as 200 or 500. status_code matches the + exact status code from the origin web server. Valid status codes are between + 100-999. + - `status_code_range`: Integer values for from and to. status_code_range matches + any status code from the origin web server within the specified range. + - `value`: An integer value that defines the duration an asset is valid in + seconds or one of the following strings: no-store (equivalent to -1), no-cache + (equivalent to 0). + """ + + class ActionDisableApps(TypedDict, total=False): id: Literal["disable_apps"] """ @@ -333,9 +364,10 @@ class ActionRespectStrongEtag(TypedDict, total=False): ActionBypassCacheOnCookie, ActionCacheByDeviceType, ActionCacheDeceptionArmor, - ActionCacheKey, + ActionCacheKeyFields, CacheLevelParam, ActionCacheOnCookie, + ActionCacheTTLByStatus, ActionDisableApps, ActionDisablePerformance, ActionDisableSecurity, diff --git a/src/cloudflare/types/r2/bucket_create_params.py b/src/cloudflare/types/r2/bucket_create_params.py index f3c106fa96f..2515c1d8a5c 100644 --- a/src/cloudflare/types/r2/bucket_create_params.py +++ b/src/cloudflare/types/r2/bucket_create_params.py @@ -22,5 +22,5 @@ class BucketCreateParams(TypedDict, total=False): storage_class: Annotated[Literal["Standard", "InfrequentAccess"], PropertyInfo(alias="storageClass")] """Storage class for newly uploaded objects, unless specified otherwise.""" - cf_r2_jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] + jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] """Creates the bucket in the provided jurisdiction""" diff --git a/src/cloudflare/types/r2/bucket_list_params.py b/src/cloudflare/types/r2/bucket_list_params.py index 81069cdc221..debb1a9c91d 100644 --- a/src/cloudflare/types/r2/bucket_list_params.py +++ b/src/cloudflare/types/r2/bucket_list_params.py @@ -37,5 +37,5 @@ class BucketListParams(TypedDict, total=False): start_after: str """Bucket name to start searching after. Buckets are ordered lexicographically.""" - cf_r2_jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] + jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] """Lists buckets in the provided jurisdiction""" diff --git a/src/cloudflare/types/r2/buckets/cors_update_params.py b/src/cloudflare/types/r2/buckets/cors_update_params.py index 3b88a5fea57..ad5b14f0775 100644 --- a/src/cloudflare/types/r2/buckets/cors_update_params.py +++ b/src/cloudflare/types/r2/buckets/cors_update_params.py @@ -16,7 +16,7 @@ class CORSUpdateParams(TypedDict, total=False): rules: Iterable[Rule] - cf_r2_jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] + jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] """The bucket jurisdiction""" diff --git a/src/cloudflare/types/r2/buckets/domains/custom_create_params.py b/src/cloudflare/types/r2/buckets/domains/custom_create_params.py index d975f7ddba6..304a30f83b6 100644 --- a/src/cloudflare/types/r2/buckets/domains/custom_create_params.py +++ b/src/cloudflare/types/r2/buckets/domains/custom_create_params.py @@ -31,5 +31,5 @@ class CustomCreateParams(TypedDict, total=False): If not set, defaults to 1.0. """ - cf_r2_jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] + jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] """The bucket jurisdiction""" diff --git a/src/cloudflare/types/r2/buckets/domains/custom_update_params.py b/src/cloudflare/types/r2/buckets/domains/custom_update_params.py index 874833c65b7..5719767b9bb 100644 --- a/src/cloudflare/types/r2/buckets/domains/custom_update_params.py +++ b/src/cloudflare/types/r2/buckets/domains/custom_update_params.py @@ -25,5 +25,5 @@ class CustomUpdateParams(TypedDict, total=False): If not set, defaults to previous value. """ - cf_r2_jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] + jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] """The bucket jurisdiction""" diff --git a/src/cloudflare/types/r2/buckets/domains/managed_update_params.py b/src/cloudflare/types/r2/buckets/domains/managed_update_params.py index 8e6546e1361..bf053372804 100644 --- a/src/cloudflare/types/r2/buckets/domains/managed_update_params.py +++ b/src/cloudflare/types/r2/buckets/domains/managed_update_params.py @@ -16,5 +16,5 @@ class ManagedUpdateParams(TypedDict, total=False): enabled: Required[bool] """Whether to enable public bucket access at the r2.dev domain""" - cf_r2_jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] + jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] """The bucket jurisdiction""" diff --git a/src/cloudflare/types/r2/buckets/event_notifications/configuration/queue_update_params.py b/src/cloudflare/types/r2/buckets/event_notifications/configuration/queue_update_params.py index 0de29620db4..6d0db95320f 100644 --- a/src/cloudflare/types/r2/buckets/event_notifications/configuration/queue_update_params.py +++ b/src/cloudflare/types/r2/buckets/event_notifications/configuration/queue_update_params.py @@ -20,7 +20,7 @@ class QueueUpdateParams(TypedDict, total=False): rules: Iterable[Rule] """Array of rules to drive notifications""" - cf_r2_jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] + jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] """The bucket jurisdiction""" diff --git a/src/cloudflare/types/r2/buckets/lifecycle_update_params.py b/src/cloudflare/types/r2/buckets/lifecycle_update_params.py index 0de8fab57b1..5ee16f78bab 100644 --- a/src/cloudflare/types/r2/buckets/lifecycle_update_params.py +++ b/src/cloudflare/types/r2/buckets/lifecycle_update_params.py @@ -31,7 +31,7 @@ class LifecycleUpdateParams(TypedDict, total=False): rules: Iterable[Rule] - cf_r2_jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] + jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] """The bucket jurisdiction""" diff --git a/src/cloudflare/types/r2/buckets/sippy_update_params.py b/src/cloudflare/types/r2/buckets/sippy_update_params.py index 3e40fe0fc31..b260ff4a373 100644 --- a/src/cloudflare/types/r2/buckets/sippy_update_params.py +++ b/src/cloudflare/types/r2/buckets/sippy_update_params.py @@ -29,7 +29,7 @@ class R2EnableSippyAws(TypedDict, total=False): source: R2EnableSippyAwsSource """AWS S3 bucket to copy objects from""" - cf_r2_jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] + jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] """The bucket jurisdiction""" @@ -83,7 +83,7 @@ class R2EnableSippyGcs(TypedDict, total=False): source: R2EnableSippyGcsSource """GCS bucket to copy objects from""" - cf_r2_jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] + jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")] """The bucket jurisdiction""" diff --git a/src/cloudflare/types/radar/ai/bots/summary_user_agent_params.py b/src/cloudflare/types/radar/ai/bots/summary_user_agent_params.py index 1056e13c5b2..448b49a9f2c 100644 --- a/src/cloudflare/types/radar/ai/bots/summary_user_agent_params.py +++ b/src/cloudflare/types/radar/ai/bots/summary_user_agent_params.py @@ -42,6 +42,12 @@ class SummaryUserAgentParams(TypedDict, total=False): format: Literal["JSON", "CSV"] """Format results are returned in.""" + limit_per_group: Annotated[int, PropertyInfo(alias="limitPerGroup")] + """ + Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + """ + location: List[str] """Array of comma separated list of locations (alpha-2 country codes). diff --git a/src/cloudflare/types/radar/ai/bots/summary_user_agent_response.py b/src/cloudflare/types/radar/ai/bots/summary_user_agent_response.py index b46f01345af..d47ce220214 100644 --- a/src/cloudflare/types/radar/ai/bots/summary_user_agent_response.py +++ b/src/cloudflare/types/radar/ai/bots/summary_user_agent_response.py @@ -53,4 +53,4 @@ class Meta(BaseModel): class SummaryUserAgentResponse(BaseModel): meta: Meta - summary_0: Dict[str, List[str]] + summary_0: Dict[str, str] diff --git a/src/cloudflare/types/radar/as112/summary_query_type_params.py b/src/cloudflare/types/radar/as112/summary_query_type_params.py index aea17cb0a58..6ff8f600ad8 100644 --- a/src/cloudflare/types/radar/as112/summary_query_type_params.py +++ b/src/cloudflare/types/radar/as112/summary_query_type_params.py @@ -42,6 +42,12 @@ class SummaryQueryTypeParams(TypedDict, total=False): format: Literal["JSON", "CSV"] """Format results are returned in.""" + limit_per_group: Annotated[int, PropertyInfo(alias="limitPerGroup")] + """ + Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + """ + location: List[str] """Array of comma separated list of locations (alpha-2 country codes). diff --git a/src/cloudflare/types/radar/as112/summary_query_type_response.py b/src/cloudflare/types/radar/as112/summary_query_type_response.py index d5268d2eb3f..87baa9cd63b 100644 --- a/src/cloudflare/types/radar/as112/summary_query_type_response.py +++ b/src/cloudflare/types/radar/as112/summary_query_type_response.py @@ -1,20 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from datetime import datetime from pydantic import Field as FieldInfo from ...._models import BaseModel -__all__ = [ - "SummaryQueryTypeResponse", - "Meta", - "MetaDateRange", - "MetaConfidenceInfo", - "MetaConfidenceInfoAnnotation", - "Summary0", -] +__all__ = ["SummaryQueryTypeResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -57,19 +50,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Summary0(BaseModel): - a: str = FieldInfo(alias="A") - - aaaa: str = FieldInfo(alias="AAAA") - - ptr: str = FieldInfo(alias="PTR") - - soa: str = FieldInfo(alias="SOA") - - srv: str = FieldInfo(alias="SRV") - - class SummaryQueryTypeResponse(BaseModel): meta: Meta - summary_0: Summary0 + summary_0: Dict[str, str] diff --git a/src/cloudflare/types/radar/as112/summary_response_codes_params.py b/src/cloudflare/types/radar/as112/summary_response_codes_params.py index 9579b04766e..1ee19186ded 100644 --- a/src/cloudflare/types/radar/as112/summary_response_codes_params.py +++ b/src/cloudflare/types/radar/as112/summary_response_codes_params.py @@ -42,6 +42,12 @@ class SummaryResponseCodesParams(TypedDict, total=False): format: Literal["JSON", "CSV"] """Format results are returned in.""" + limit_per_group: Annotated[int, PropertyInfo(alias="limitPerGroup")] + """ + Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + """ + location: List[str] """Array of comma separated list of locations (alpha-2 country codes). diff --git a/src/cloudflare/types/radar/as112/summary_response_codes_response.py b/src/cloudflare/types/radar/as112/summary_response_codes_response.py index 9c916f07a98..f4e19fe4238 100644 --- a/src/cloudflare/types/radar/as112/summary_response_codes_response.py +++ b/src/cloudflare/types/radar/as112/summary_response_codes_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from datetime import datetime from pydantic import Field as FieldInfo @@ -13,7 +13,6 @@ "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation", - "Summary0", ] @@ -57,13 +56,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Summary0(BaseModel): - noerror: str = FieldInfo(alias="NOERROR") - - nxdomain: str = FieldInfo(alias="NXDOMAIN") - - class SummaryResponseCodesResponse(BaseModel): meta: Meta - summary_0: Summary0 + summary_0: Dict[str, str] diff --git a/src/cloudflare/types/radar/as112/timeseries_group_query_type_params.py b/src/cloudflare/types/radar/as112/timeseries_group_query_type_params.py index d83568fe1d3..cb0afb94023 100644 --- a/src/cloudflare/types/radar/as112/timeseries_group_query_type_params.py +++ b/src/cloudflare/types/radar/as112/timeseries_group_query_type_params.py @@ -49,6 +49,12 @@ class TimeseriesGroupQueryTypeParams(TypedDict, total=False): format: Literal["JSON", "CSV"] """Format results are returned in.""" + limit_per_group: Annotated[int, PropertyInfo(alias="limitPerGroup")] + """ + Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + """ + location: List[str] """Array of comma separated list of locations (alpha-2 country codes). diff --git a/src/cloudflare/types/radar/as112/timeseries_group_response_codes_params.py b/src/cloudflare/types/radar/as112/timeseries_group_response_codes_params.py index 05cf4ac7fab..50fa3dd1979 100644 --- a/src/cloudflare/types/radar/as112/timeseries_group_response_codes_params.py +++ b/src/cloudflare/types/radar/as112/timeseries_group_response_codes_params.py @@ -49,6 +49,12 @@ class TimeseriesGroupResponseCodesParams(TypedDict, total=False): format: Literal["JSON", "CSV"] """Format results are returned in.""" + limit_per_group: Annotated[int, PropertyInfo(alias="limitPerGroup")] + """ + Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + """ + location: List[str] """Array of comma separated list of locations (alpha-2 country codes). diff --git a/src/cloudflare/types/radar/attacks/layer3/summary_vector_params.py b/src/cloudflare/types/radar/attacks/layer3/summary_vector_params.py index 3da6f2912a7..55e3ea8a30a 100644 --- a/src/cloudflare/types/radar/attacks/layer3/summary_vector_params.py +++ b/src/cloudflare/types/radar/attacks/layer3/summary_vector_params.py @@ -44,6 +44,12 @@ class SummaryVectorParams(TypedDict, total=False): ip_version: Annotated[List[Literal["IPv4", "IPv6"]], PropertyInfo(alias="ipVersion")] """Filter for ip version.""" + limit_per_group: Annotated[int, PropertyInfo(alias="limitPerGroup")] + """ + Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + """ + location: List[str] """Array of comma separated list of locations (alpha-2 country codes). diff --git a/src/cloudflare/types/radar/attacks/layer3/summary_vector_response.py b/src/cloudflare/types/radar/attacks/layer3/summary_vector_response.py index cf21e355719..7dd4becaf4b 100644 --- a/src/cloudflare/types/radar/attacks/layer3/summary_vector_response.py +++ b/src/cloudflare/types/radar/attacks/layer3/summary_vector_response.py @@ -53,4 +53,4 @@ class Meta(BaseModel): class SummaryVectorResponse(BaseModel): meta: Meta - summary_0: Dict[str, List[str]] + summary_0: Dict[str, str] diff --git a/src/cloudflare/types/radar/attacks/layer7/summary_http_method_params.py b/src/cloudflare/types/radar/attacks/layer7/summary_http_method_params.py index 6060fcfa603..056c66ca9f4 100644 --- a/src/cloudflare/types/radar/attacks/layer7/summary_http_method_params.py +++ b/src/cloudflare/types/radar/attacks/layer7/summary_http_method_params.py @@ -48,6 +48,12 @@ class SummaryHTTPMethodParams(TypedDict, total=False): ip_version: Annotated[List[Literal["IPv4", "IPv6"]], PropertyInfo(alias="ipVersion")] """Filter for ip version.""" + limit_per_group: Annotated[int, PropertyInfo(alias="limitPerGroup")] + """ + Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + """ + location: List[str] """Array of comma separated list of locations (alpha-2 country codes). diff --git a/src/cloudflare/types/radar/attacks/layer7/summary_http_method_response.py b/src/cloudflare/types/radar/attacks/layer7/summary_http_method_response.py index 38203e4eb07..79afadef9b6 100644 --- a/src/cloudflare/types/radar/attacks/layer7/summary_http_method_response.py +++ b/src/cloudflare/types/radar/attacks/layer7/summary_http_method_response.py @@ -1,20 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from datetime import datetime from pydantic import Field as FieldInfo from ....._models import BaseModel -__all__ = [ - "SummaryHTTPMethodResponse", - "Meta", - "MetaDateRange", - "MetaConfidenceInfo", - "MetaConfidenceInfoAnnotation", - "Summary0", -] +__all__ = ["SummaryHTTPMethodResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -57,13 +50,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Summary0(BaseModel): - get: str = FieldInfo(alias="GET") - - post: str = FieldInfo(alias="POST") - - class SummaryHTTPMethodResponse(BaseModel): meta: Meta - summary_0: Summary0 + summary_0: Dict[str, str] diff --git a/src/cloudflare/types/radar/attacks/layer7/summary_managed_rules_params.py b/src/cloudflare/types/radar/attacks/layer7/summary_managed_rules_params.py index 5dfedbebd51..16197925be5 100644 --- a/src/cloudflare/types/radar/attacks/layer7/summary_managed_rules_params.py +++ b/src/cloudflare/types/radar/attacks/layer7/summary_managed_rules_params.py @@ -103,6 +103,12 @@ class SummaryManagedRulesParams(TypedDict, total=False): ip_version: Annotated[List[Literal["IPv4", "IPv6"]], PropertyInfo(alias="ipVersion")] """Filter for ip version.""" + limit_per_group: Annotated[int, PropertyInfo(alias="limitPerGroup")] + """ + Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + """ + location: List[str] """Array of comma separated list of locations (alpha-2 country codes). diff --git a/src/cloudflare/types/radar/attacks/layer7/summary_managed_rules_response.py b/src/cloudflare/types/radar/attacks/layer7/summary_managed_rules_response.py index 2a095a472e6..d63373ae0c7 100644 --- a/src/cloudflare/types/radar/attacks/layer7/summary_managed_rules_response.py +++ b/src/cloudflare/types/radar/attacks/layer7/summary_managed_rules_response.py @@ -53,4 +53,4 @@ class Meta(BaseModel): class SummaryManagedRulesResponse(BaseModel): meta: Meta - summary_0: Dict[str, List[str]] + summary_0: Dict[str, str] diff --git a/src/cloudflare/types/radar/attacks/layer7/summary_mitigation_product_params.py b/src/cloudflare/types/radar/attacks/layer7/summary_mitigation_product_params.py index 4013e1ee425..55a45aa7fc1 100644 --- a/src/cloudflare/types/radar/attacks/layer7/summary_mitigation_product_params.py +++ b/src/cloudflare/types/radar/attacks/layer7/summary_mitigation_product_params.py @@ -103,6 +103,12 @@ class SummaryMitigationProductParams(TypedDict, total=False): ip_version: Annotated[List[Literal["IPv4", "IPv6"]], PropertyInfo(alias="ipVersion")] """Filter for ip version.""" + limit_per_group: Annotated[int, PropertyInfo(alias="limitPerGroup")] + """ + Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + """ + location: List[str] """Array of comma separated list of locations (alpha-2 country codes). diff --git a/src/cloudflare/types/radar/attacks/layer7/summary_mitigation_product_response.py b/src/cloudflare/types/radar/attacks/layer7/summary_mitigation_product_response.py index f815da2375a..eebfb391f20 100644 --- a/src/cloudflare/types/radar/attacks/layer7/summary_mitigation_product_response.py +++ b/src/cloudflare/types/radar/attacks/layer7/summary_mitigation_product_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from datetime import datetime from pydantic import Field as FieldInfo @@ -13,7 +13,6 @@ "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation", - "Summary0", ] @@ -57,13 +56,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Summary0(BaseModel): - ddos: str = FieldInfo(alias="DDOS") - - waf: str = FieldInfo(alias="WAF") - - class SummaryMitigationProductResponse(BaseModel): meta: Meta - summary_0: Summary0 + summary_0: Dict[str, str] diff --git a/src/cloudflare/types/radar/attacks/layer7/timeseries_group_http_method_params.py b/src/cloudflare/types/radar/attacks/layer7/timeseries_group_http_method_params.py index d6ea3e4eec2..098e2050b40 100644 --- a/src/cloudflare/types/radar/attacks/layer7/timeseries_group_http_method_params.py +++ b/src/cloudflare/types/radar/attacks/layer7/timeseries_group_http_method_params.py @@ -55,6 +55,12 @@ class TimeseriesGroupHTTPMethodParams(TypedDict, total=False): ip_version: Annotated[List[Literal["IPv4", "IPv6"]], PropertyInfo(alias="ipVersion")] """Filter for ip version.""" + limit_per_group: Annotated[int, PropertyInfo(alias="limitPerGroup")] + """ + Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + """ + location: List[str] """Array of comma separated list of locations (alpha-2 country codes). diff --git a/src/cloudflare/types/radar/attacks/layer7/timeseries_group_http_method_response.py b/src/cloudflare/types/radar/attacks/layer7/timeseries_group_http_method_response.py index a0f6379a2c5..45e7a8b8a9f 100644 --- a/src/cloudflare/types/radar/attacks/layer7/timeseries_group_http_method_response.py +++ b/src/cloudflare/types/radar/attacks/layer7/timeseries_group_http_method_response.py @@ -1,8 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List - -from pydantic import Field as FieldInfo +from typing import TYPE_CHECKING, List from ....._models import BaseModel @@ -10,10 +8,14 @@ class Serie0(BaseModel): - get: List[str] = FieldInfo(alias="GET") - timestamps: List[str] + if TYPE_CHECKING: + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> List[str]: ... + class TimeseriesGroupHTTPMethodResponse(BaseModel): meta: object diff --git a/src/cloudflare/types/radar/attacks/layer7/timeseries_group_http_version_response.py b/src/cloudflare/types/radar/attacks/layer7/timeseries_group_http_version_response.py index f8085143fa2..0aeb0474fd0 100644 --- a/src/cloudflare/types/radar/attacks/layer7/timeseries_group_http_version_response.py +++ b/src/cloudflare/types/radar/attacks/layer7/timeseries_group_http_version_response.py @@ -12,6 +12,10 @@ class Serie0(BaseModel): http_1_x: List[str] = FieldInfo(alias="HTTP/1.x") + http_2: List[str] = FieldInfo(alias="HTTP/2") + + http_3: List[str] = FieldInfo(alias="HTTP/3") + timestamps: List[str] diff --git a/src/cloudflare/types/radar/attacks/layer7/timeseries_group_managed_rules_params.py b/src/cloudflare/types/radar/attacks/layer7/timeseries_group_managed_rules_params.py index 7c26f5c6c64..055a4d3e140 100644 --- a/src/cloudflare/types/radar/attacks/layer7/timeseries_group_managed_rules_params.py +++ b/src/cloudflare/types/radar/attacks/layer7/timeseries_group_managed_rules_params.py @@ -110,6 +110,12 @@ class TimeseriesGroupManagedRulesParams(TypedDict, total=False): ip_version: Annotated[List[Literal["IPv4", "IPv6"]], PropertyInfo(alias="ipVersion")] """Filter for ip version.""" + limit_per_group: Annotated[int, PropertyInfo(alias="limitPerGroup")] + """ + Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + """ + location: List[str] """Array of comma separated list of locations (alpha-2 country codes). diff --git a/src/cloudflare/types/radar/attacks/layer7/timeseries_group_mitigation_product_params.py b/src/cloudflare/types/radar/attacks/layer7/timeseries_group_mitigation_product_params.py index 7dfb3741259..97c71692e3c 100644 --- a/src/cloudflare/types/radar/attacks/layer7/timeseries_group_mitigation_product_params.py +++ b/src/cloudflare/types/radar/attacks/layer7/timeseries_group_mitigation_product_params.py @@ -110,6 +110,12 @@ class TimeseriesGroupMitigationProductParams(TypedDict, total=False): ip_version: Annotated[List[Literal["IPv4", "IPv6"]], PropertyInfo(alias="ipVersion")] """Filter for ip version.""" + limit_per_group: Annotated[int, PropertyInfo(alias="limitPerGroup")] + """ + Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + """ + location: List[str] """Array of comma separated list of locations (alpha-2 country codes). diff --git a/src/cloudflare/types/radar/attacks/layer7/timeseries_group_mitigation_product_response.py b/src/cloudflare/types/radar/attacks/layer7/timeseries_group_mitigation_product_response.py index 7e598104c96..b3e88c1e6a0 100644 --- a/src/cloudflare/types/radar/attacks/layer7/timeseries_group_mitigation_product_response.py +++ b/src/cloudflare/types/radar/attacks/layer7/timeseries_group_mitigation_product_response.py @@ -1,8 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List - -from pydantic import Field as FieldInfo +from typing import TYPE_CHECKING, List from ....._models import BaseModel @@ -10,10 +8,14 @@ class Serie0(BaseModel): - ddos: List[str] = FieldInfo(alias="DDOS") - timestamps: List[str] + if TYPE_CHECKING: + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> List[str]: ... + class TimeseriesGroupMitigationProductResponse(BaseModel): meta: object diff --git a/src/cloudflare/types/radar/http/timeseries_group_browser_family_params.py b/src/cloudflare/types/radar/http/timeseries_group_browser_family_params.py index df17101636c..ae16d65d0c7 100644 --- a/src/cloudflare/types/radar/http/timeseries_group_browser_family_params.py +++ b/src/cloudflare/types/radar/http/timeseries_group_browser_family_params.py @@ -68,6 +68,12 @@ class TimeseriesGroupBrowserFamilyParams(TypedDict, total=False): ip_version: Annotated[List[Literal["IPv4", "IPv6"]], PropertyInfo(alias="ipVersion")] """Filter for ip version.""" + limit_per_group: Annotated[int, PropertyInfo(alias="limitPerGroup")] + """ + Limit the number of objects (eg browsers, verticals, etc) to the top items over + the time range. + """ + location: List[str] """Array of comma separated list of locations (alpha-2 country codes). diff --git a/src/cloudflare/types/radar/ranking/domain_get_params.py b/src/cloudflare/types/radar/ranking/domain_get_params.py index 98bbbaf27da..95eb1587c83 100644 --- a/src/cloudflare/types/radar/ranking/domain_get_params.py +++ b/src/cloudflare/types/radar/ranking/domain_get_params.py @@ -2,7 +2,8 @@ from __future__ import annotations -from typing import List +import datetime +from typing import List, Union from typing_extensions import Literal, Annotated, TypedDict from ...._utils import PropertyInfo @@ -11,12 +12,15 @@ class DomainGetParams(TypedDict, total=False): - date: List[str] + date: Annotated[List[Union[str, datetime.date]], PropertyInfo(format="iso8601")] """Array of dates to filter the ranking.""" format: Literal["JSON", "CSV"] """Format results are returned in.""" + include_top_locations: Annotated[bool, PropertyInfo(alias="includeTopLocations")] + """Include top locations in the response.""" + limit: int """Limit the number of objects in the response.""" diff --git a/src/cloudflare/types/radar/ranking_top_params.py b/src/cloudflare/types/radar/ranking_top_params.py index e482e6f9f96..903af228882 100644 --- a/src/cloudflare/types/radar/ranking_top_params.py +++ b/src/cloudflare/types/radar/ranking_top_params.py @@ -2,7 +2,8 @@ from __future__ import annotations -from typing import List +import datetime +from typing import List, Union from typing_extensions import Literal, Annotated, TypedDict from ..._utils import PropertyInfo @@ -11,7 +12,7 @@ class RankingTopParams(TypedDict, total=False): - date: List[str] + date: Annotated[List[Union[str, datetime.date]], PropertyInfo(format="iso8601")] """Array of dates to filter the ranking.""" format: Literal["JSON", "CSV"] diff --git a/src/cloudflare/types/radar/tcp_resets_timeout_timeseries_groups_response.py b/src/cloudflare/types/radar/tcp_resets_timeout_timeseries_groups_response.py index 84e1ce0e8ea..b6ab06c0b94 100644 --- a/src/cloudflare/types/radar/tcp_resets_timeout_timeseries_groups_response.py +++ b/src/cloudflare/types/radar/tcp_resets_timeout_timeseries_groups_response.py @@ -59,31 +59,14 @@ class Meta(BaseModel): class Serie0(BaseModel): later_in_flow: List[str] - """ - Connection resets within the first 10 packets from the client, but after the - server has received multiple data packets. - """ no_match: List[str] - """All other connections.""" post_ack: List[str] - """ - Connection resets or timeouts after the server received both a SYN packet and an - ACK packet, meaning the connection was successfully established. - """ post_psh: List[str] - """ - Connection resets or timeouts after the server received a packet with PSH flag - set, following connection establishment. - """ post_syn: List[str] - """ - Connection resets or timeouts after the server received only a single SYN - packet. - """ timestamps: List[datetime] diff --git a/src/cloudflare/types/rules/lists/item_get_response.py b/src/cloudflare/types/rules/lists/item_get_response.py index 7ed243ab3ae..7293cef70a3 100644 --- a/src/cloudflare/types/rules/lists/item_get_response.py +++ b/src/cloudflare/types/rules/lists/item_get_response.py @@ -1,19 +1,15 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional -from typing_extensions import TypeAlias +from typing import Optional from ..hostname import Hostname from ..redirect import Redirect +from ...._models import BaseModel -__all__ = ["ItemGetResponse", "UnionMember0", "RulesListsRedirect", "RulesListsHostname", "UnionMember3"] +__all__ = ["ItemGetResponse"] -class UnionMember0: - pass - - -class RulesListsRedirect(Redirect): +class ItemGetResponse(BaseModel): id: Optional[str] = None """The unique ID of the list.""" @@ -43,42 +39,3 @@ class RulesListsRedirect(Redirect): redirect: Optional[Redirect] = None """The definition of the redirect.""" - - -class RulesListsHostname(Hostname): - id: Optional[str] = None - """The unique ID of the list.""" - - asn: Optional[int] = None - """A non-negative 32 bit integer""" - - comment: Optional[str] = None - """An informative summary of the list item.""" - - created_on: Optional[str] = None - """The RFC 3339 timestamp of when the item was created.""" - - hostname: Optional[Hostname] = None - """ - Valid characters for hostnames are ASCII(7) letters from a to z, the digits from - 0 to 9, wildcards (\\**), and the hyphen (-). - """ - - ip: Optional[str] = None - """An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. - - IPv6 CIDRs are limited to a maximum of /64. - """ - - modified_on: Optional[str] = None - """The RFC 3339 timestamp of when the item was last modified.""" - - redirect: Optional[Redirect] = None - """The definition of the redirect.""" - - -class UnionMember3: - pass - - -ItemGetResponse: TypeAlias = Union[UnionMember0, RulesListsRedirect, RulesListsHostname, UnionMember3] diff --git a/src/cloudflare/types/rules/lists/item_list_response.py b/src/cloudflare/types/rules/lists/item_list_response.py index 21703540fd6..233b99f1da7 100644 --- a/src/cloudflare/types/rules/lists/item_list_response.py +++ b/src/cloudflare/types/rules/lists/item_list_response.py @@ -1,19 +1,15 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional -from typing_extensions import TypeAlias +from typing import Optional from ..hostname import Hostname from ..redirect import Redirect +from ...._models import BaseModel -__all__ = ["ItemListResponse", "UnionMember0", "RulesListsRedirect", "RulesListsHostname", "UnionMember3"] +__all__ = ["ItemListResponse"] -class UnionMember0: - pass - - -class RulesListsRedirect(Redirect): +class ItemListResponse(BaseModel): id: Optional[str] = None """The unique ID of the list.""" @@ -43,42 +39,3 @@ class RulesListsRedirect(Redirect): redirect: Optional[Redirect] = None """The definition of the redirect.""" - - -class RulesListsHostname(Hostname): - id: Optional[str] = None - """The unique ID of the list.""" - - asn: Optional[int] = None - """A non-negative 32 bit integer""" - - comment: Optional[str] = None - """An informative summary of the list item.""" - - created_on: Optional[str] = None - """The RFC 3339 timestamp of when the item was created.""" - - hostname: Optional[Hostname] = None - """ - Valid characters for hostnames are ASCII(7) letters from a to z, the digits from - 0 to 9, wildcards (\\**), and the hyphen (-). - """ - - ip: Optional[str] = None - """An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. - - IPv6 CIDRs are limited to a maximum of /64. - """ - - modified_on: Optional[str] = None - """The RFC 3339 timestamp of when the item was last modified.""" - - redirect: Optional[Redirect] = None - """The definition of the redirect.""" - - -class UnionMember3: - pass - - -ItemListResponse: TypeAlias = Union[UnionMember0, RulesListsRedirect, RulesListsHostname, UnionMember3] diff --git a/src/cloudflare/types/rulesets/rule_create_params.py b/src/cloudflare/types/rulesets/rule_create_params.py index efc9c72846f..bb8fb83441d 100644 --- a/src/cloudflare/types/rulesets/rule_create_params.py +++ b/src/cloudflare/types/rulesets/rule_create_params.py @@ -147,8 +147,14 @@ "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader", "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost", "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString", - "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude", - "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParameters", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersInclude", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeSomeQueryStringParameters", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeAllQueryStringParameters", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParameters", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExclude", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeSomeQueryStringParameters", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeAllQueryStringParameters", "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser", "SetCacheSettingsRuleActionParametersCacheReserve", "SetCacheSettingsRuleActionParametersEdgeTTL", @@ -2276,40 +2282,68 @@ class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(TypedDict, total """ -class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(TypedDict, total=False): +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeSomeQueryStringParameters( + TypedDict, total=False +): + list: List[str] + + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeAllQueryStringParameters( + TypedDict, total=False +): all: bool - """Exclude all query string parameters from use in building the cache key.""" + """Determines whether to include all query string parameters in the cache key.""" - list: List[str] - """A list of query string parameters NOT used to build the cache key. - All parameters present in the request but missing in this list will be used to - build the cache key. - """ +SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersInclude: TypeAlias = Union[ + SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeSomeQueryStringParameters, + SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeAllQueryStringParameters, +] -class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(TypedDict, total=False): - all: bool - """Use all query string parameters in the cache key.""" +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParameters( + TypedDict, total=False +): + include: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersInclude + """A list of query string parameters used to build the cache key.""" + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeSomeQueryStringParameters( + TypedDict, total=False +): list: List[str] - """A list of query string parameters used to build the cache key.""" -class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(TypedDict, total=False): - exclude: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude - """ - build the cache key using all query string parameters EXCECPT these excluded - parameters - """ +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeAllQueryStringParameters( + TypedDict, total=False +): + all: bool + """Determines whether to exclude all query string parameters from the cache key.""" - include: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude - """ - build the cache key using a list of query string parameters that ARE in the - request. + +SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExclude: TypeAlias = Union[ + SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeSomeQueryStringParameters, + SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeAllQueryStringParameters, +] + + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParameters( + TypedDict, total=False +): + exclude: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExclude + """A list of query string parameters NOT used to build the cache key. + + All parameters present in the request but missing in this list will be used to + build the cache key. """ +SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString: TypeAlias = Union[ + SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParameters, + SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParameters, +] + + class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(TypedDict, total=False): device_type: bool """Use the user agent's device type in the cache key.""" @@ -2332,10 +2366,7 @@ class SetCacheSettingsRuleActionParametersCacheKeyCustomKey(TypedDict, total=Fal """Whether to use the original host or the resolved host in the cache key.""" query_string: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString - """ - Use the presence or absence of parameters in the query string to build the cache - key. - """ + """Use the presence of parameters in the query string to build the cache key.""" user: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser """Characteristics of the request user agent used in building the cache key.""" diff --git a/src/cloudflare/types/rulesets/rule_edit_params.py b/src/cloudflare/types/rulesets/rule_edit_params.py index 201bf84f5b3..396a92a4459 100644 --- a/src/cloudflare/types/rulesets/rule_edit_params.py +++ b/src/cloudflare/types/rulesets/rule_edit_params.py @@ -147,8 +147,14 @@ "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader", "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost", "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString", - "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude", - "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParameters", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersInclude", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeSomeQueryStringParameters", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeAllQueryStringParameters", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParameters", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExclude", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeSomeQueryStringParameters", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeAllQueryStringParameters", "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser", "SetCacheSettingsRuleActionParametersCacheReserve", "SetCacheSettingsRuleActionParametersEdgeTTL", @@ -2321,40 +2327,68 @@ class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(TypedDict, total """ -class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(TypedDict, total=False): +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeSomeQueryStringParameters( + TypedDict, total=False +): + list: List[str] + + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeAllQueryStringParameters( + TypedDict, total=False +): all: bool - """Exclude all query string parameters from use in building the cache key.""" + """Determines whether to include all query string parameters in the cache key.""" - list: List[str] - """A list of query string parameters NOT used to build the cache key. - All parameters present in the request but missing in this list will be used to - build the cache key. - """ +SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersInclude: TypeAlias = Union[ + SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeSomeQueryStringParameters, + SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeAllQueryStringParameters, +] -class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(TypedDict, total=False): - all: bool - """Use all query string parameters in the cache key.""" +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParameters( + TypedDict, total=False +): + include: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersInclude + """A list of query string parameters used to build the cache key.""" + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeSomeQueryStringParameters( + TypedDict, total=False +): list: List[str] - """A list of query string parameters used to build the cache key.""" -class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(TypedDict, total=False): - exclude: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude - """ - build the cache key using all query string parameters EXCECPT these excluded - parameters - """ +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeAllQueryStringParameters( + TypedDict, total=False +): + all: bool + """Determines whether to exclude all query string parameters from the cache key.""" - include: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude - """ - build the cache key using a list of query string parameters that ARE in the - request. + +SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExclude: TypeAlias = Union[ + SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeSomeQueryStringParameters, + SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeAllQueryStringParameters, +] + + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParameters( + TypedDict, total=False +): + exclude: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExclude + """A list of query string parameters NOT used to build the cache key. + + All parameters present in the request but missing in this list will be used to + build the cache key. """ +SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString: TypeAlias = Union[ + SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParameters, + SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParameters, +] + + class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(TypedDict, total=False): device_type: bool """Use the user agent's device type in the cache key.""" @@ -2377,10 +2411,7 @@ class SetCacheSettingsRuleActionParametersCacheKeyCustomKey(TypedDict, total=Fal """Whether to use the original host or the resolved host in the cache key.""" query_string: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString - """ - Use the presence or absence of parameters in the query string to build the cache - key. - """ + """Use the presence of parameters in the query string to build the cache key.""" user: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser """Characteristics of the request user agent used in building the cache key.""" diff --git a/src/cloudflare/types/rulesets/set_cache_settings_rule.py b/src/cloudflare/types/rulesets/set_cache_settings_rule.py index 2b35f718029..e88114d9f66 100644 --- a/src/cloudflare/types/rulesets/set_cache_settings_rule.py +++ b/src/cloudflare/types/rulesets/set_cache_settings_rule.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Optional +from typing import Dict, List, Union, Optional from datetime import datetime -from typing_extensions import Literal +from typing_extensions import Literal, TypeAlias from pydantic import Field as FieldInfo @@ -19,8 +19,14 @@ "ActionParametersCacheKeyCustomKeyHeader", "ActionParametersCacheKeyCustomKeyHost", "ActionParametersCacheKeyCustomKeyQueryString", - "ActionParametersCacheKeyCustomKeyQueryStringExclude", - "ActionParametersCacheKeyCustomKeyQueryStringInclude", + "ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParameters", + "ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersInclude", + "ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeSomeQueryStringParameters", + "ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeAllQueryStringParameters", + "ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParameters", + "ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExclude", + "ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeSomeQueryStringParameters", + "ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeAllQueryStringParameters", "ActionParametersCacheKeyCustomKeyUser", "ActionParametersCacheReserve", "ActionParametersEdgeTTL", @@ -85,40 +91,64 @@ class ActionParametersCacheKeyCustomKeyHost(BaseModel): """ -class ActionParametersCacheKeyCustomKeyQueryStringExclude(BaseModel): +class ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeSomeQueryStringParameters( + BaseModel +): + rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None) + + +class ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeAllQueryStringParameters( + BaseModel +): all: Optional[bool] = None - """Exclude all query string parameters from use in building the cache key.""" + """Determines whether to include all query string parameters in the cache key.""" - rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None) - """A list of query string parameters NOT used to build the cache key. - All parameters present in the request but missing in this list will be used to - build the cache key. - """ +ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersInclude: TypeAlias = Union[ + ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeSomeQueryStringParameters, + ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeAllQueryStringParameters, +] -class ActionParametersCacheKeyCustomKeyQueryStringInclude(BaseModel): - all: Optional[bool] = None - """Use all query string parameters in the cache key.""" +class ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParameters(BaseModel): + include: Optional[ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersInclude] = None + """A list of query string parameters used to build the cache key.""" + +class ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeSomeQueryStringParameters( + BaseModel +): rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None) - """A list of query string parameters used to build the cache key.""" -class ActionParametersCacheKeyCustomKeyQueryString(BaseModel): - exclude: Optional[ActionParametersCacheKeyCustomKeyQueryStringExclude] = None - """ - build the cache key using all query string parameters EXCECPT these excluded - parameters - """ +class ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeAllQueryStringParameters( + BaseModel +): + all: Optional[bool] = None + """Determines whether to exclude all query string parameters from the cache key.""" - include: Optional[ActionParametersCacheKeyCustomKeyQueryStringInclude] = None - """ - build the cache key using a list of query string parameters that ARE in the - request. + +ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExclude: TypeAlias = Union[ + ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeSomeQueryStringParameters, + ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeAllQueryStringParameters, +] + + +class ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParameters(BaseModel): + exclude: Optional[ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExclude] = None + """A list of query string parameters NOT used to build the cache key. + + All parameters present in the request but missing in this list will be used to + build the cache key. """ +ActionParametersCacheKeyCustomKeyQueryString: TypeAlias = Union[ + ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParameters, + ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParameters, +] + + class ActionParametersCacheKeyCustomKeyUser(BaseModel): device_type: Optional[bool] = None """Use the user agent's device type in the cache key.""" @@ -141,10 +171,7 @@ class ActionParametersCacheKeyCustomKey(BaseModel): """Whether to use the original host or the resolved host in the cache key.""" query_string: Optional[ActionParametersCacheKeyCustomKeyQueryString] = None - """ - Use the presence or absence of parameters in the query string to build the cache - key. - """ + """Use the presence of parameters in the query string to build the cache key.""" user: Optional[ActionParametersCacheKeyCustomKeyUser] = None """Characteristics of the request user agent used in building the cache key.""" diff --git a/src/cloudflare/types/rulesets/set_cache_settings_rule_param.py b/src/cloudflare/types/rulesets/set_cache_settings_rule_param.py index ff8c9861e22..ed6d9f5818e 100644 --- a/src/cloudflare/types/rulesets/set_cache_settings_rule_param.py +++ b/src/cloudflare/types/rulesets/set_cache_settings_rule_param.py @@ -2,8 +2,8 @@ from __future__ import annotations -from typing import Dict, List, Iterable -from typing_extensions import Literal, Required, TypedDict +from typing import Dict, List, Union, Iterable +from typing_extensions import Literal, Required, TypeAlias, TypedDict from .logging_param import LoggingParam @@ -17,8 +17,14 @@ "ActionParametersCacheKeyCustomKeyHeader", "ActionParametersCacheKeyCustomKeyHost", "ActionParametersCacheKeyCustomKeyQueryString", - "ActionParametersCacheKeyCustomKeyQueryStringExclude", - "ActionParametersCacheKeyCustomKeyQueryStringInclude", + "ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParameters", + "ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersInclude", + "ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeSomeQueryStringParameters", + "ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeAllQueryStringParameters", + "ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParameters", + "ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExclude", + "ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeSomeQueryStringParameters", + "ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeAllQueryStringParameters", "ActionParametersCacheKeyCustomKeyUser", "ActionParametersCacheReserve", "ActionParametersEdgeTTL", @@ -83,40 +89,64 @@ class ActionParametersCacheKeyCustomKeyHost(TypedDict, total=False): """ -class ActionParametersCacheKeyCustomKeyQueryStringExclude(TypedDict, total=False): +class ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeSomeQueryStringParameters( + TypedDict, total=False +): + list: List[str] + + +class ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeAllQueryStringParameters( + TypedDict, total=False +): all: bool - """Exclude all query string parameters from use in building the cache key.""" + """Determines whether to include all query string parameters in the cache key.""" - list: List[str] - """A list of query string parameters NOT used to build the cache key. - All parameters present in the request but missing in this list will be used to - build the cache key. - """ +ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersInclude: TypeAlias = Union[ + ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeSomeQueryStringParameters, + ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersIncludeAllQueryStringParameters, +] -class ActionParametersCacheKeyCustomKeyQueryStringInclude(TypedDict, total=False): - all: bool - """Use all query string parameters in the cache key.""" +class ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParameters(TypedDict, total=False): + include: ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParametersInclude + """A list of query string parameters used to build the cache key.""" + +class ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeSomeQueryStringParameters( + TypedDict, total=False +): list: List[str] - """A list of query string parameters used to build the cache key.""" -class ActionParametersCacheKeyCustomKeyQueryString(TypedDict, total=False): - exclude: ActionParametersCacheKeyCustomKeyQueryStringExclude - """ - build the cache key using all query string parameters EXCECPT these excluded - parameters - """ +class ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeAllQueryStringParameters( + TypedDict, total=False +): + all: bool + """Determines whether to exclude all query string parameters from the cache key.""" - include: ActionParametersCacheKeyCustomKeyQueryStringInclude - """ - build the cache key using a list of query string parameters that ARE in the - request. + +ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExclude: TypeAlias = Union[ + ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeSomeQueryStringParameters, + ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExcludeAllQueryStringParameters, +] + + +class ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParameters(TypedDict, total=False): + exclude: ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParametersExclude + """A list of query string parameters NOT used to build the cache key. + + All parameters present in the request but missing in this list will be used to + build the cache key. """ +ActionParametersCacheKeyCustomKeyQueryString: TypeAlias = Union[ + ActionParametersCacheKeyCustomKeyQueryStringIncludedQueryStringParameters, + ActionParametersCacheKeyCustomKeyQueryStringExcludedQueryStringParameters, +] + + class ActionParametersCacheKeyCustomKeyUser(TypedDict, total=False): device_type: bool """Use the user agent's device type in the cache key.""" @@ -139,10 +169,7 @@ class ActionParametersCacheKeyCustomKey(TypedDict, total=False): """Whether to use the original host or the resolved host in the cache key.""" query_string: ActionParametersCacheKeyCustomKeyQueryString - """ - Use the presence or absence of parameters in the query string to build the cache - key. - """ + """Use the presence of parameters in the query string to build the cache key.""" user: ActionParametersCacheKeyCustomKeyUser """Characteristics of the request user agent used in building the cache key.""" diff --git a/src/cloudflare/types/shared/token.py b/src/cloudflare/types/shared/token.py index 60c5cc8e911..fd4787368c9 100644 --- a/src/cloudflare/types/shared/token.py +++ b/src/cloudflare/types/shared/token.py @@ -22,7 +22,7 @@ class ConditionRequestIP(BaseModel): class Condition(BaseModel): - request_ip: Optional[ConditionRequestIP] = FieldInfo(alias="request.ip", default=None) + request_ip: Optional[ConditionRequestIP] = None """Client IP restrictions.""" diff --git a/src/cloudflare/types/shared/token_policy.py b/src/cloudflare/types/shared/token_policy.py index 9611c150894..10909830a01 100644 --- a/src/cloudflare/types/shared/token_policy.py +++ b/src/cloudflare/types/shared/token_policy.py @@ -1,11 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from typing_extensions import Literal from ..._models import BaseModel -__all__ = ["TokenPolicy", "PermissionGroup", "PermissionGroupMeta", "Resources"] +__all__ = ["TokenPolicy", "PermissionGroup", "PermissionGroupMeta"] class PermissionGroupMeta(BaseModel): @@ -25,12 +25,6 @@ class PermissionGroup(BaseModel): """Name of the group.""" -class Resources(BaseModel): - resource: Optional[str] = None - - scope: Optional[str] = None - - class TokenPolicy(BaseModel): id: str """Policy identifier.""" @@ -41,5 +35,5 @@ class TokenPolicy(BaseModel): permission_groups: List[PermissionGroup] """A set of permission groups that are specified to the policy.""" - resources: Resources + resources: Dict[str, str] """A list of resource names that the policy applies to.""" diff --git a/src/cloudflare/types/shared_params/token_policy.py b/src/cloudflare/types/shared_params/token_policy.py index 789802e3df7..96b7d37451f 100644 --- a/src/cloudflare/types/shared_params/token_policy.py +++ b/src/cloudflare/types/shared_params/token_policy.py @@ -2,10 +2,10 @@ from __future__ import annotations -from typing import Iterable +from typing import Dict, Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["TokenPolicy", "PermissionGroup", "PermissionGroupMeta", "Resources"] +__all__ = ["TokenPolicy", "PermissionGroup", "PermissionGroupMeta"] class PermissionGroupMeta(TypedDict, total=False): @@ -19,12 +19,6 @@ class PermissionGroup(TypedDict, total=False): """Attributes associated to the permission group.""" -class Resources(TypedDict, total=False): - resource: str - - scope: str - - class TokenPolicy(TypedDict, total=False): effect: Required[Literal["allow", "deny"]] """Allow or deny operations against the resources.""" @@ -32,5 +26,5 @@ class TokenPolicy(TypedDict, total=False): permission_groups: Required[Iterable[PermissionGroup]] """A set of permission groups that are specified to the policy.""" - resources: Required[Resources] + resources: Required[Dict[str, str]] """A list of resource names that the policy applies to.""" diff --git a/src/cloudflare/types/url_normalization/url_normalization_get_response.py b/src/cloudflare/types/url_normalization/url_normalization_get_response.py index 0bebaa4413c..9ea0d8949ea 100644 --- a/src/cloudflare/types/url_normalization/url_normalization_get_response.py +++ b/src/cloudflare/types/url_normalization/url_normalization_get_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing_extensions import Literal from ..._models import BaseModel @@ -8,8 +8,8 @@ class URLNormalizationGetResponse(BaseModel): - scope: Optional[str] = None + scope: Literal["incoming", "both"] """The scope of the URL normalization.""" - type: Optional[str] = None + type: Literal["cloudflare", "rfc3986"] """The type of URL normalization performed by Cloudflare.""" diff --git a/src/cloudflare/types/url_normalization/url_normalization_update_params.py b/src/cloudflare/types/url_normalization/url_normalization_update_params.py index fb2b4551fa4..77533d9d48a 100644 --- a/src/cloudflare/types/url_normalization/url_normalization_update_params.py +++ b/src/cloudflare/types/url_normalization/url_normalization_update_params.py @@ -2,17 +2,17 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing_extensions import Literal, Required, TypedDict __all__ = ["URLNormalizationUpdateParams"] class URLNormalizationUpdateParams(TypedDict, total=False): zone_id: Required[str] - """Identifier""" + """The unique ID of the zone.""" - scope: str + scope: Required[Literal["incoming", "both"]] """The scope of the URL normalization.""" - type: str + type: Required[Literal["cloudflare", "rfc3986"]] """The type of URL normalization performed by Cloudflare.""" diff --git a/src/cloudflare/types/url_normalization/url_normalization_update_response.py b/src/cloudflare/types/url_normalization/url_normalization_update_response.py index b7d70096ced..610eef85af1 100644 --- a/src/cloudflare/types/url_normalization/url_normalization_update_response.py +++ b/src/cloudflare/types/url_normalization/url_normalization_update_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing_extensions import Literal from ..._models import BaseModel @@ -8,8 +8,8 @@ class URLNormalizationUpdateResponse(BaseModel): - scope: Optional[str] = None + scope: Literal["incoming", "both"] """The scope of the URL normalization.""" - type: Optional[str] = None + type: Literal["cloudflare", "rfc3986"] """The type of URL normalization performed by Cloudflare.""" diff --git a/src/cloudflare/types/url_scanner/scan_bulk_create_params.py b/src/cloudflare/types/url_scanner/scan_bulk_create_params.py index 8bdd2ef9263..6509c75550e 100644 --- a/src/cloudflare/types/url_scanner/scan_bulk_create_params.py +++ b/src/cloudflare/types/url_scanner/scan_bulk_create_params.py @@ -11,6 +11,9 @@ class ScanBulkCreateParams(TypedDict, total=False): + account_id: Required[str] + """Account ID.""" + body: Required[Iterable[Body]] """List of urls to scan (up to a 100).""" diff --git a/src/cloudflare/types/url_scanner/scan_create_params.py b/src/cloudflare/types/url_scanner/scan_create_params.py index 16a71092669..782da4a9c85 100644 --- a/src/cloudflare/types/url_scanner/scan_create_params.py +++ b/src/cloudflare/types/url_scanner/scan_create_params.py @@ -11,6 +11,9 @@ class ScanCreateParams(TypedDict, total=False): + account_id: Required[str] + """Account ID.""" + url: Required[str] customagent: str diff --git a/src/cloudflare/types/url_scanner/scan_list_params.py b/src/cloudflare/types/url_scanner/scan_list_params.py index c13e697eda1..97421b92ccc 100644 --- a/src/cloudflare/types/url_scanner/scan_list_params.py +++ b/src/cloudflare/types/url_scanner/scan_list_params.py @@ -2,12 +2,15 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing_extensions import Required, TypedDict __all__ = ["ScanListParams"] class ScanListParams(TypedDict, total=False): + account_id: Required[str] + """Account ID.""" + q: str """Filter scans""" diff --git a/src/cloudflare/types/url_scanner/scan_screenshot_params.py b/src/cloudflare/types/url_scanner/scan_screenshot_params.py index 2b3a24b0dd4..263a003363f 100644 --- a/src/cloudflare/types/url_scanner/scan_screenshot_params.py +++ b/src/cloudflare/types/url_scanner/scan_screenshot_params.py @@ -2,16 +2,14 @@ from __future__ import annotations -from typing_extensions import Literal, Required, Annotated, TypedDict - -from ..._utils import PropertyInfo +from typing_extensions import Literal, Required, TypedDict __all__ = ["ScanScreenshotParams"] class ScanScreenshotParams(TypedDict, total=False): - account_id: Required[Annotated[str, PropertyInfo(alias="accountId")]] - """Account Id.""" + account_id: Required[str] + """Account ID.""" resolution: Literal["desktop", "mobile", "tablet"] """Target device type.""" diff --git a/src/cloudflare/types/user/token_create_params.py b/src/cloudflare/types/user/token_create_params.py index bf9e2e8de5b..166b95b2e7f 100644 --- a/src/cloudflare/types/user/token_create_params.py +++ b/src/cloudflare/types/user/token_create_params.py @@ -47,5 +47,5 @@ class ConditionRequestIP(_ConditionRequestIPReservedKeywords, total=False): class Condition(TypedDict, total=False): - request_ip: Annotated[ConditionRequestIP, PropertyInfo(alias="request.ip")] + request_ip: ConditionRequestIP """Client IP restrictions.""" diff --git a/src/cloudflare/types/user/token_create_response.py b/src/cloudflare/types/user/token_create_response.py index cfc75aba10c..baad5983f71 100644 --- a/src/cloudflare/types/user/token_create_response.py +++ b/src/cloudflare/types/user/token_create_response.py @@ -23,7 +23,7 @@ class ConditionRequestIP(BaseModel): class Condition(BaseModel): - request_ip: Optional[ConditionRequestIP] = FieldInfo(alias="request.ip", default=None) + request_ip: Optional[ConditionRequestIP] = None """Client IP restrictions.""" diff --git a/src/cloudflare/types/user/token_update_params.py b/src/cloudflare/types/user/token_update_params.py index 55c166825b4..b48ae15215b 100644 --- a/src/cloudflare/types/user/token_update_params.py +++ b/src/cloudflare/types/user/token_update_params.py @@ -50,5 +50,5 @@ class ConditionRequestIP(_ConditionRequestIPReservedKeywords, total=False): class Condition(TypedDict, total=False): - request_ip: Annotated[ConditionRequestIP, PropertyInfo(alias="request.ip")] + request_ip: ConditionRequestIP """Client IP restrictions.""" diff --git a/src/cloudflare/types/vectorize/index_delete_response.py b/src/cloudflare/types/vectorize/index_delete_response.py index 2680eb61604..04ceee6b545 100644 --- a/src/cloudflare/types/vectorize/index_delete_response.py +++ b/src/cloudflare/types/vectorize/index_delete_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["IndexDeleteResponse"] -IndexDeleteResponse: TypeAlias = Union[Optional[str], Optional[object]] +IndexDeleteResponse: TypeAlias = Union[str, object, None] diff --git a/src/cloudflare/types/waiting_rooms/waiting_room.py b/src/cloudflare/types/waiting_rooms/waiting_room.py index eff1d6b5d24..0364a65dfb7 100644 --- a/src/cloudflare/types/waiting_rooms/waiting_room.py +++ b/src/cloudflare/types/waiting_rooms/waiting_room.py @@ -376,3 +376,22 @@ class WaitingRoom(BaseModel): active users sessions on the route based on the traffic patterns at that time around the world. """ + + turnstile_action: Optional[Literal["log", "infinite_queue"]] = None + """Which action to take when a bot is detected using Turnstile. + + `log` will have no impact on queueing behavior, simply keeping track of how many + bots are detected in Waiting Room Analytics. `infinite_queue` will send bots to + a false queueing state, where they will never reach your origin. + `infinite_queue` requires Advanced Waiting Room. + """ + + turnstile_mode: Optional[Literal["off", "invisible", "visible_non_interactive", "visible_managed"]] = None + """Which Turnstile widget type to use for detecting bot traffic. + + See + [the Turnstile documentation](https://developers.cloudflare.com/turnstile/concepts/widget/#widget-types) + for the definitions of these widget types. Set to `off` to disable the Turnstile + integration entirely. Setting this to anything other than `off` or `invisible` + requires Advanced Waiting Room. + """ diff --git a/src/cloudflare/types/waiting_rooms/waiting_room_create_params.py b/src/cloudflare/types/waiting_rooms/waiting_room_create_params.py index ef0cf714c53..775fc8974ca 100644 --- a/src/cloudflare/types/waiting_rooms/waiting_room_create_params.py +++ b/src/cloudflare/types/waiting_rooms/waiting_room_create_params.py @@ -365,3 +365,22 @@ class WaitingRoomCreateParams(TypedDict, total=False): If set to `true`, the traffic will not go to the waiting room. """ + + turnstile_action: Literal["log", "infinite_queue"] + """Which action to take when a bot is detected using Turnstile. + + `log` will have no impact on queueing behavior, simply keeping track of how many + bots are detected in Waiting Room Analytics. `infinite_queue` will send bots to + a false queueing state, where they will never reach your origin. + `infinite_queue` requires Advanced Waiting Room. + """ + + turnstile_mode: Literal["off", "invisible", "visible_non_interactive", "visible_managed"] + """Which Turnstile widget type to use for detecting bot traffic. + + See + [the Turnstile documentation](https://developers.cloudflare.com/turnstile/concepts/widget/#widget-types) + for the definitions of these widget types. Set to `off` to disable the Turnstile + integration entirely. Setting this to anything other than `off` or `invisible` + requires Advanced Waiting Room. + """ diff --git a/src/cloudflare/types/waiting_rooms/waiting_room_edit_params.py b/src/cloudflare/types/waiting_rooms/waiting_room_edit_params.py index f47bf7c06c6..c2c494dc57c 100644 --- a/src/cloudflare/types/waiting_rooms/waiting_room_edit_params.py +++ b/src/cloudflare/types/waiting_rooms/waiting_room_edit_params.py @@ -365,3 +365,22 @@ class WaitingRoomEditParams(TypedDict, total=False): If set to `true`, the traffic will not go to the waiting room. """ + + turnstile_action: Literal["log", "infinite_queue"] + """Which action to take when a bot is detected using Turnstile. + + `log` will have no impact on queueing behavior, simply keeping track of how many + bots are detected in Waiting Room Analytics. `infinite_queue` will send bots to + a false queueing state, where they will never reach your origin. + `infinite_queue` requires Advanced Waiting Room. + """ + + turnstile_mode: Literal["off", "invisible", "visible_non_interactive", "visible_managed"] + """Which Turnstile widget type to use for detecting bot traffic. + + See + [the Turnstile documentation](https://developers.cloudflare.com/turnstile/concepts/widget/#widget-types) + for the definitions of these widget types. Set to `off` to disable the Turnstile + integration entirely. Setting this to anything other than `off` or `invisible` + requires Advanced Waiting Room. + """ diff --git a/src/cloudflare/types/waiting_rooms/waiting_room_update_params.py b/src/cloudflare/types/waiting_rooms/waiting_room_update_params.py index f93d914d4b0..52e93cfbc38 100644 --- a/src/cloudflare/types/waiting_rooms/waiting_room_update_params.py +++ b/src/cloudflare/types/waiting_rooms/waiting_room_update_params.py @@ -365,3 +365,22 @@ class WaitingRoomUpdateParams(TypedDict, total=False): If set to `true`, the traffic will not go to the waiting room. """ + + turnstile_action: Literal["log", "infinite_queue"] + """Which action to take when a bot is detected using Turnstile. + + `log` will have no impact on queueing behavior, simply keeping track of how many + bots are detected in Waiting Room Analytics. `infinite_queue` will send bots to + a false queueing state, where they will never reach your origin. + `infinite_queue` requires Advanced Waiting Room. + """ + + turnstile_mode: Literal["off", "invisible", "visible_non_interactive", "visible_managed"] + """Which Turnstile widget type to use for detecting bot traffic. + + See + [the Turnstile documentation](https://developers.cloudflare.com/turnstile/concepts/widget/#widget-types) + for the definitions of these widget types. Set to `off` to disable the Turnstile + integration entirely. Setting this to anything other than `off` or `invisible` + requires Advanced Waiting Room. + """ diff --git a/src/cloudflare/types/workers/__init__.py b/src/cloudflare/types/workers/__init__.py index 57bde2d76cb..201450ef852 100644 --- a/src/cloudflare/types/workers/__init__.py +++ b/src/cloudflare/types/workers/__init__.py @@ -4,42 +4,28 @@ from .domain import Domain as Domain from .script import Script as Script -from .binding import Binding as Binding -from .d1_binding import D1Binding as D1Binding -from .r2_binding import R2Binding as R2Binding -from .ai_run_params import AIRunParams as AIRunParams -from .binding_param import BindingParam as BindingParam from .migration_step import MigrationStep as MigrationStep from .script_setting import ScriptSetting as ScriptSetting -from .ai_run_response import AIRunResponse as AIRunResponse -from .service_binding import ServiceBinding as ServiceBinding -from .d1_binding_param import D1BindingParam as D1BindingParam -from .r2_binding_param import R2BindingParam as R2BindingParam -from .mtls_cert_binding import MTLSCERTBinding as MTLSCERTBinding -from .stepped_migration import SteppedMigration as SteppedMigration from .domain_list_params import DomainListParams as DomainListParams +from .route_get_response import RouteGetResponse as RouteGetResponse +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 .script_get_response import ScriptGetResponse as ScriptGetResponse from .domain_update_params import DomainUpdateParams as DomainUpdateParams -from .kv_namespace_binding import KVNamespaceBinding as KVNamespaceBinding from .migration_step_param import MigrationStepParam as MigrationStepParam from .script_delete_params import ScriptDeleteParams as ScriptDeleteParams from .script_update_params import ScriptUpdateParams as ScriptUpdateParams -from .service_binding_param import ServiceBindingParam as ServiceBindingParam +from .route_create_response import RouteCreateResponse as RouteCreateResponse +from .route_delete_response import RouteDeleteResponse as RouteDeleteResponse +from .route_update_response import RouteUpdateResponse as RouteUpdateResponse from .single_step_migration import SingleStepMigration as SingleStepMigration from .worker_metadata_param import WorkerMetadataParam as WorkerMetadataParam -from .durable_object_binding import DurableObjectBinding as DurableObjectBinding from .script_update_response import ScriptUpdateResponse as ScriptUpdateResponse from .subdomain_get_response import SubdomainGetResponse as SubdomainGetResponse -from .mtls_cert_binding_param import MTLSCERTBindingParam as MTLSCERTBindingParam -from .placement_configuration import PlacementConfiguration as PlacementConfiguration -from .stepped_migration_param import SteppedMigrationParam as SteppedMigrationParam from .subdomain_update_params import SubdomainUpdateParams as SubdomainUpdateParams from .subdomain_update_response import SubdomainUpdateResponse as SubdomainUpdateResponse -from .dispatch_namespace_binding import DispatchNamespaceBinding as DispatchNamespaceBinding -from .kv_namespace_binding_param import KVNamespaceBindingParam as KVNamespaceBindingParam from .single_step_migration_param import SingleStepMigrationParam as SingleStepMigrationParam from .account_setting_get_response import AccountSettingGetResponse as AccountSettingGetResponse -from .durable_object_binding_param import DurableObjectBindingParam as DurableObjectBindingParam from .account_setting_update_params import AccountSettingUpdateParams as AccountSettingUpdateParams -from .placement_configuration_param import PlacementConfigurationParam as PlacementConfigurationParam from .account_setting_update_response import AccountSettingUpdateResponse as AccountSettingUpdateResponse -from .dispatch_namespace_binding_param import DispatchNamespaceBindingParam as DispatchNamespaceBindingParam diff --git a/src/cloudflare/types/workers/binding.py b/src/cloudflare/types/workers/binding.py deleted file mode 100644 index 9a34a8ef377..00000000000 --- a/src/cloudflare/types/workers/binding.py +++ /dev/null @@ -1,47 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union -from typing_extensions import Literal, TypeAlias - -from ..._models import BaseModel -from .d1_binding import D1Binding -from .r2_binding import R2Binding -from .service_binding import ServiceBinding -from .mtls_cert_binding import MTLSCERTBinding -from .kv_namespace_binding import KVNamespaceBinding -from .durable_object_binding import DurableObjectBinding -from .dispatch_namespace_binding import DispatchNamespaceBinding - -__all__ = ["Binding", "WorkersQueueBinding", "WorkersAssetsBinding"] - - -class WorkersQueueBinding(BaseModel): - name: str - """A JavaScript variable name for the binding.""" - - queue_name: str - """Name of the Queue to bind to""" - - type: Literal["queue"] - """The class of resource that the binding provides.""" - - -class WorkersAssetsBinding(BaseModel): - name: str - """A JavaScript variable name for the binding.""" - - type: Literal["assets"] - """The class of resource that the binding provides.""" - - -Binding: TypeAlias = Union[ - KVNamespaceBinding, - ServiceBinding, - DurableObjectBinding, - R2Binding, - WorkersQueueBinding, - D1Binding, - DispatchNamespaceBinding, - MTLSCERTBinding, - WorkersAssetsBinding, -] diff --git a/src/cloudflare/types/workers/binding_param.py b/src/cloudflare/types/workers/binding_param.py deleted file mode 100644 index b0d2a41ab37..00000000000 --- a/src/cloudflare/types/workers/binding_param.py +++ /dev/null @@ -1,42 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from typing_extensions import Literal, Required, TypeAlias, TypedDict - -from .d1_binding_param import D1BindingParam -from .r2_binding_param import R2BindingParam -from .service_binding_param import ServiceBindingParam -from .mtls_cert_binding_param import MTLSCERTBindingParam -from .kv_namespace_binding_param import KVNamespaceBindingParam -from .durable_object_binding_param import DurableObjectBindingParam -from .dispatch_namespace_binding_param import DispatchNamespaceBindingParam - -__all__ = ["BindingParam", "WorkersQueueBinding", "WorkersAssetsBinding"] - - -class WorkersQueueBinding(TypedDict, total=False): - queue_name: Required[str] - """Name of the Queue to bind to""" - - type: Required[Literal["queue"]] - """The class of resource that the binding provides.""" - - -class WorkersAssetsBinding(TypedDict, total=False): - type: Required[Literal["assets"]] - """The class of resource that the binding provides.""" - - -BindingParam: TypeAlias = Union[ - KVNamespaceBindingParam, - ServiceBindingParam, - DurableObjectBindingParam, - R2BindingParam, - WorkersQueueBinding, - D1BindingParam, - DispatchNamespaceBindingParam, - MTLSCERTBindingParam, - WorkersAssetsBinding, -] diff --git a/src/cloudflare/types/workers/d1_binding.py b/src/cloudflare/types/workers/d1_binding.py deleted file mode 100644 index 7010fcfa068..00000000000 --- a/src/cloudflare/types/workers/d1_binding.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["D1Binding"] - - -class D1Binding(BaseModel): - id: str - """ID of the D1 database to bind to""" - - binding: str - """A JavaScript variable name for the binding.""" - - name: str - """The name of the D1 database associated with the 'id' provided.""" - - type: Literal["d1"] - """The class of resource that the binding provides.""" diff --git a/src/cloudflare/types/workers/d1_binding_param.py b/src/cloudflare/types/workers/d1_binding_param.py deleted file mode 100644 index 74face1628f..00000000000 --- a/src/cloudflare/types/workers/d1_binding_param.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["D1BindingParam"] - - -class D1BindingParam(TypedDict, total=False): - id: Required[str] - """ID of the D1 database to bind to""" - - name: Required[str] - """The name of the D1 database associated with the 'id' provided.""" - - type: Required[Literal["d1"]] - """The class of resource that the binding provides.""" diff --git a/src/cloudflare/types/workers/dispatch_namespace_binding.py b/src/cloudflare/types/workers/dispatch_namespace_binding.py deleted file mode 100644 index 7211e0a0dbb..00000000000 --- a/src/cloudflare/types/workers/dispatch_namespace_binding.py +++ /dev/null @@ -1,41 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["DispatchNamespaceBinding", "Outbound", "OutboundWorker"] - - -class OutboundWorker(BaseModel): - environment: Optional[str] = None - """Environment of the outbound worker""" - - service: Optional[str] = None - """Name of the outbound worker""" - - -class Outbound(BaseModel): - params: Optional[List[str]] = None - """ - Pass information from the Dispatch Worker to the Outbound Worker through the - parameters - """ - - worker: Optional[OutboundWorker] = None - """Outbound worker""" - - -class DispatchNamespaceBinding(BaseModel): - name: str - """A JavaScript variable name for the binding.""" - - namespace: str - """Namespace to bind to""" - - type: Literal["dispatch_namespace"] - """The class of resource that the binding provides.""" - - outbound: Optional[Outbound] = None - """Outbound worker""" diff --git a/src/cloudflare/types/workers/dispatch_namespace_binding_param.py b/src/cloudflare/types/workers/dispatch_namespace_binding_param.py deleted file mode 100644 index 584c5d86e15..00000000000 --- a/src/cloudflare/types/workers/dispatch_namespace_binding_param.py +++ /dev/null @@ -1,38 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["DispatchNamespaceBindingParam", "Outbound", "OutboundWorker"] - - -class OutboundWorker(TypedDict, total=False): - environment: str - """Environment of the outbound worker""" - - service: str - """Name of the outbound worker""" - - -class Outbound(TypedDict, total=False): - params: List[str] - """ - Pass information from the Dispatch Worker to the Outbound Worker through the - parameters - """ - - worker: OutboundWorker - """Outbound worker""" - - -class DispatchNamespaceBindingParam(TypedDict, total=False): - namespace: Required[str] - """Namespace to bind to""" - - type: Required[Literal["dispatch_namespace"]] - """The class of resource that the binding provides.""" - - outbound: Outbound - """Outbound worker""" diff --git a/src/cloudflare/types/workers/durable_object_binding.py b/src/cloudflare/types/workers/durable_object_binding.py deleted file mode 100644 index acef5a67aae..00000000000 --- a/src/cloudflare/types/workers/durable_object_binding.py +++ /dev/null @@ -1,30 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["DurableObjectBinding"] - - -class DurableObjectBinding(BaseModel): - class_name: str - """The exported class name of the Durable Object""" - - name: str - """A JavaScript variable name for the binding.""" - - type: Literal["durable_object_namespace"] - """The class of resource that the binding provides.""" - - environment: Optional[str] = None - """The environment of the script_name to bind to""" - - namespace_id: Optional[str] = None - """Namespace identifier tag.""" - - script_name: Optional[str] = None - """ - The script where the Durable Object is defined, if it is external to this Worker - """ diff --git a/src/cloudflare/types/workers/durable_object_binding_param.py b/src/cloudflare/types/workers/durable_object_binding_param.py deleted file mode 100644 index 6c00bbd63a9..00000000000 --- a/src/cloudflare/types/workers/durable_object_binding_param.py +++ /dev/null @@ -1,23 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["DurableObjectBindingParam"] - - -class DurableObjectBindingParam(TypedDict, total=False): - class_name: Required[str] - """The exported class name of the Durable Object""" - - type: Required[Literal["durable_object_namespace"]] - """The class of resource that the binding provides.""" - - environment: str - """The environment of the script_name to bind to""" - - script_name: str - """ - The script where the Durable Object is defined, if it is external to this Worker - """ diff --git a/src/cloudflare/types/workers/kv_namespace_binding.py b/src/cloudflare/types/workers/kv_namespace_binding.py deleted file mode 100644 index bf28ce9caac..00000000000 --- a/src/cloudflare/types/workers/kv_namespace_binding.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["KVNamespaceBinding"] - - -class KVNamespaceBinding(BaseModel): - name: str - """A JavaScript variable name for the binding.""" - - namespace_id: str - """Namespace identifier tag.""" - - type: Literal["kv_namespace"] - """The class of resource that the binding provides.""" diff --git a/src/cloudflare/types/workers/kv_namespace_binding_param.py b/src/cloudflare/types/workers/kv_namespace_binding_param.py deleted file mode 100644 index 7dc97bab2a6..00000000000 --- a/src/cloudflare/types/workers/kv_namespace_binding_param.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["KVNamespaceBindingParam"] - - -class KVNamespaceBindingParam(TypedDict, total=False): - type: Required[Literal["kv_namespace"]] - """The class of resource that the binding provides.""" diff --git a/src/cloudflare/types/workers/mtls_cert_binding.py b/src/cloudflare/types/workers/mtls_cert_binding.py deleted file mode 100644 index e80080bd283..00000000000 --- a/src/cloudflare/types/workers/mtls_cert_binding.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["MTLSCERTBinding"] - - -class MTLSCERTBinding(BaseModel): - certificate_id: str - """ID of the certificate to bind to""" - - name: str - """A JavaScript variable name for the binding.""" - - type: Literal["mtls_certificate"] - """The class of resource that the binding provides.""" diff --git a/src/cloudflare/types/workers/mtls_cert_binding_param.py b/src/cloudflare/types/workers/mtls_cert_binding_param.py deleted file mode 100644 index 5dbf4a2d61b..00000000000 --- a/src/cloudflare/types/workers/mtls_cert_binding_param.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["MTLSCERTBindingParam"] - - -class MTLSCERTBindingParam(TypedDict, total=False): - certificate_id: Required[str] - """ID of the certificate to bind to""" - - type: Required[Literal["mtls_certificate"]] - """The class of resource that the binding provides.""" diff --git a/src/cloudflare/types/workers/placement_configuration.py b/src/cloudflare/types/workers/placement_configuration.py deleted file mode 100644 index 0eb2b9eec7d..00000000000 --- a/src/cloudflare/types/workers/placement_configuration.py +++ /dev/null @@ -1,17 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["PlacementConfiguration"] - - -class PlacementConfiguration(BaseModel): - mode: Optional[Literal["smart"]] = None - """ - Enables - [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - Only `"smart"` is currently supported - """ diff --git a/src/cloudflare/types/workers/placement_configuration_param.py b/src/cloudflare/types/workers/placement_configuration_param.py deleted file mode 100644 index f6ef4c070fd..00000000000 --- a/src/cloudflare/types/workers/placement_configuration_param.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["PlacementConfigurationParam"] - - -class PlacementConfigurationParam(TypedDict, total=False): - mode: Literal["smart"] - """ - Enables - [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - Only `"smart"` is currently supported - """ diff --git a/src/cloudflare/types/workers/r2_binding.py b/src/cloudflare/types/workers/r2_binding.py deleted file mode 100644 index 523844ac272..00000000000 --- a/src/cloudflare/types/workers/r2_binding.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["R2Binding"] - - -class R2Binding(BaseModel): - bucket_name: str - """R2 bucket to bind to""" - - name: str - """A JavaScript variable name for the binding.""" - - type: Literal["r2_bucket"] - """The class of resource that the binding provides.""" diff --git a/src/cloudflare/types/workers/r2_binding_param.py b/src/cloudflare/types/workers/r2_binding_param.py deleted file mode 100644 index 559667ded10..00000000000 --- a/src/cloudflare/types/workers/r2_binding_param.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["R2BindingParam"] - - -class R2BindingParam(TypedDict, total=False): - bucket_name: Required[str] - """R2 bucket to bind to""" - - type: Required[Literal["r2_bucket"]] - """The class of resource that the binding provides.""" diff --git a/src/cloudflare/types/workers/route_create_params.py b/src/cloudflare/types/workers/route_create_params.py new file mode 100644 index 00000000000..479c701b0e9 --- /dev/null +++ b/src/cloudflare/types/workers/route_create_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["RouteCreateParams"] + + +class RouteCreateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + pattern: Required[str] + + script: str + """Name of the script, used in URLs and route configuration.""" diff --git a/src/cloudflare/types/addressing/prefixes/bgp/binding_delete_response.py b/src/cloudflare/types/workers/route_create_response.py similarity index 64% rename from src/cloudflare/types/addressing/prefixes/bgp/binding_delete_response.py rename to src/cloudflare/types/workers/route_create_response.py index 9746074b34a..9e27967d480 100644 --- a/src/cloudflare/types/addressing/prefixes/bgp/binding_delete_response.py +++ b/src/cloudflare/types/workers/route_create_response.py @@ -3,13 +3,13 @@ from typing import List from typing_extensions import Literal -from ....._models import BaseModel -from ....shared.response_info import ResponseInfo +from ..._models import BaseModel +from ..shared.response_info import ResponseInfo -__all__ = ["BindingDeleteResponse"] +__all__ = ["RouteCreateResponse"] -class BindingDeleteResponse(BaseModel): +class RouteCreateResponse(BaseModel): errors: List[ResponseInfo] messages: List[ResponseInfo] diff --git a/src/cloudflare/types/workers/route_delete_response.py b/src/cloudflare/types/workers/route_delete_response.py new file mode 100644 index 00000000000..df25ccce223 --- /dev/null +++ b/src/cloudflare/types/workers/route_delete_response.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import Literal + +from ..._models import BaseModel +from ..shared.response_info import ResponseInfo + +__all__ = ["RouteDeleteResponse"] + + +class RouteDeleteResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + success: Literal[True] + """Whether the API call was successful""" diff --git a/src/cloudflare/types/workers/route_get_response.py b/src/cloudflare/types/workers/route_get_response.py new file mode 100644 index 00000000000..169dcf43ea2 --- /dev/null +++ b/src/cloudflare/types/workers/route_get_response.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..._models import BaseModel + +__all__ = ["RouteGetResponse"] + + +class RouteGetResponse(BaseModel): + id: str + """Identifier""" + + pattern: str + + script: str + """Name of the script, used in URLs and route configuration.""" diff --git a/src/cloudflare/types/workers/route_list_response.py b/src/cloudflare/types/workers/route_list_response.py new file mode 100644 index 00000000000..b6002c20b63 --- /dev/null +++ b/src/cloudflare/types/workers/route_list_response.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..._models import BaseModel + +__all__ = ["RouteListResponse"] + + +class RouteListResponse(BaseModel): + id: str + """Identifier""" + + pattern: str + + script: str + """Name of the script, used in URLs and route configuration.""" diff --git a/src/cloudflare/types/workers/route_update_params.py b/src/cloudflare/types/workers/route_update_params.py new file mode 100644 index 00000000000..d4954d0bd6a --- /dev/null +++ b/src/cloudflare/types/workers/route_update_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["RouteUpdateParams"] + + +class RouteUpdateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + pattern: Required[str] + + script: str + """Name of the script, used in URLs and route configuration.""" diff --git a/src/cloudflare/types/workers/route_update_response.py b/src/cloudflare/types/workers/route_update_response.py new file mode 100644 index 00000000000..1c2e70ac262 --- /dev/null +++ b/src/cloudflare/types/workers/route_update_response.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..._models import BaseModel + +__all__ = ["RouteUpdateResponse"] + + +class RouteUpdateResponse(BaseModel): + id: str + """Identifier""" + + pattern: str + + script: str + """Name of the script, used in URLs and route configuration.""" diff --git a/src/cloudflare/types/workers/script.py b/src/cloudflare/types/workers/script.py index f57a98a895f..336e5797a4f 100644 --- a/src/cloudflare/types/workers/script.py +++ b/src/cloudflare/types/workers/script.py @@ -2,11 +2,26 @@ from typing import List, Optional from datetime import datetime +from typing_extensions import Literal from ..._models import BaseModel from .scripts.consumer_script import ConsumerScript -__all__ = ["Script"] +__all__ = ["Script", "Placement"] + + +class Placement(BaseModel): + mode: Optional[Literal["smart"]] = None + """ + Enables + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ + + status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]] = None + """ + Status of + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ class Script(BaseModel): @@ -31,11 +46,26 @@ class Script(BaseModel): modified_on: Optional[datetime] = None """When the script was last modified.""" - placement_mode: Optional[str] = None - """Specifies the placement mode for the Worker (e.g. 'smart').""" + placement: Optional[Placement] = None + """ + Configuration for + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ + + placement_mode: Optional[Literal["smart"]] = None + """ + Enables + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ + + placement_status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]] = None + """ + Status of + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ tail_consumers: Optional[List[ConsumerScript]] = None """List of Workers that will consume logs from the attached Worker.""" - usage_model: Optional[str] = None - """Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound').""" + usage_model: Optional[Literal["standard"]] = None + """Usage model for the Worker invocations.""" diff --git a/src/cloudflare/types/workers/script_get_response.py b/src/cloudflare/types/workers/script_get_response.py new file mode 100644 index 00000000000..7d789c074c7 --- /dev/null +++ b/src/cloudflare/types/workers/script_get_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import TypeAlias + +__all__ = ["ScriptGetResponse"] + +ScriptGetResponse: TypeAlias = str diff --git a/src/cloudflare/types/workers/script_update_params.py b/src/cloudflare/types/workers/script_update_params.py index ebdb23511ac..3bac9979ed1 100644 --- a/src/cloudflare/types/workers/script_update_params.py +++ b/src/cloudflare/types/workers/script_update_params.py @@ -3,54 +3,56 @@ from __future__ import annotations from typing import Dict, List, Union, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing_extensions import Literal, Required, TypeAlias, TypedDict -from ..._types import FileTypes -from ..._utils import PropertyInfo -from .stepped_migration_param import SteppedMigrationParam +from .migration_step_param import MigrationStepParam from .single_step_migration_param import SingleStepMigrationParam -from .placement_configuration_param import PlacementConfigurationParam from .scripts.consumer_script_param import ConsumerScriptParam __all__ = [ "ScriptUpdateParams", - "Variant0", - "Variant0Metadata", - "Variant0MetadataAssets", - "Variant0MetadataAssetsConfig", - "Variant0MetadataBinding", - "Variant0MetadataMigrations", - "Variant0MetadataObservability", - "Variant1", + "Metadata", + "MetadataAssets", + "MetadataAssetsConfig", + "MetadataBinding", + "MetadataBindingWorkersBindingKindAny", + "MetadataBindingWorkersBindingKindAI", + "MetadataBindingWorkersBindingKindAnalyticsEngine", + "MetadataBindingWorkersBindingKindAssets", + "MetadataBindingWorkersBindingKindBrowserRendering", + "MetadataBindingWorkersBindingKindD1", + "MetadataBindingWorkersBindingKindDispatchNamespace", + "MetadataBindingWorkersBindingKindDispatchNamespaceOutbound", + "MetadataBindingWorkersBindingKindDispatchNamespaceOutboundWorker", + "MetadataBindingWorkersBindingKindDo", + "MetadataBindingWorkersBindingKindHyperdrive", + "MetadataBindingWorkersBindingKindJson", + "MetadataBindingWorkersBindingKindKVNamespace", + "MetadataBindingWorkersBindingKindMTLSCERT", + "MetadataBindingWorkersBindingKindPlainText", + "MetadataBindingWorkersBindingKindQueue", + "MetadataBindingWorkersBindingKindR2", + "MetadataBindingWorkersBindingKindSecret", + "MetadataBindingWorkersBindingKindService", + "MetadataBindingWorkersBindingKindTailConsumer", + "MetadataBindingWorkersBindingKindVectorize", + "MetadataBindingWorkersBindingKindVersionMetadata", + "MetadataMigrations", + "MetadataMigrationsWorkersMultipleStepMigrations", + "MetadataObservability", + "MetadataPlacement", ] -class Variant0(TypedDict, total=False): +class ScriptUpdateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - rollback_to: str - """Rollback to provided deployment based on deployment ID. - - Request body will only parse a "message" part. You can learn more about - deployments - [here](https://developers.cloudflare.com/workers/platform/deployments/). - """ - - any_part_name: Annotated[List[FileTypes], PropertyInfo(alias="")] - """A module comprising a Worker script, often a javascript file. - - Multiple modules may be provided as separate named parts, but at least one - module must be present and referenced in the metadata as `main_module` or - `body_part` by part name. Source maps may also be included using the - `application/source-map` content type. - """ - - metadata: Variant0Metadata + metadata: Required[Metadata] """JSON encoded metadata about the uploaded parts and Worker configuration.""" -class Variant0MetadataAssetsConfig(TypedDict, total=False): +class MetadataAssetsConfig(TypedDict, total=False): html_handling: Literal["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"] """Determines the redirects and rewrites of requests for HTML content.""" @@ -68,32 +70,301 @@ class Variant0MetadataAssetsConfig(TypedDict, total=False): """ -class Variant0MetadataAssets(TypedDict, total=False): - config: Variant0MetadataAssetsConfig +class MetadataAssets(TypedDict, total=False): + config: MetadataAssetsConfig """Configuration for assets within a Worker.""" jwt: str """Token provided upon successful upload of all files from a registered manifest.""" -class Variant0MetadataBindingTyped(TypedDict, total=False): - name: str - """Name of the binding variable.""" +class MetadataBindingWorkersBindingKindAnyTyped(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" - type: str - """Type of binding. + type: Required[str] + """The kind of resource that the binding provides.""" - You can find more about bindings on our docs: - https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings. + +MetadataBindingWorkersBindingKindAny: TypeAlias = Union[MetadataBindingWorkersBindingKindAnyTyped, Dict[str, object]] + + +class MetadataBindingWorkersBindingKindAI(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["ai"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindAnalyticsEngine(TypedDict, total=False): + dataset: Required[str] + """The dataset name to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["analytics_engine"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindAssets(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["assets"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindBrowserRendering(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["browser_rendering"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindD1(TypedDict, total=False): + id: Required[str] + """Identifier of the D1 database to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["d1"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindDispatchNamespaceOutboundWorker(TypedDict, total=False): + environment: str + """Environment of the outbound worker.""" + + service: str + """Name of the outbound worker.""" + + +class MetadataBindingWorkersBindingKindDispatchNamespaceOutbound(TypedDict, total=False): + params: List[str] + """ + Pass information from the Dispatch Worker to the Outbound Worker through the + parameters. + """ + + worker: MetadataBindingWorkersBindingKindDispatchNamespaceOutboundWorker + """Outbound worker.""" + + +class MetadataBindingWorkersBindingKindDispatchNamespace(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + namespace: Required[str] + """Namespace to bind to.""" + + type: Required[Literal["dispatch_namespace"]] + """The kind of resource that the binding provides.""" + + outbound: MetadataBindingWorkersBindingKindDispatchNamespaceOutbound + """Outbound worker.""" + + +class MetadataBindingWorkersBindingKindDo(TypedDict, total=False): + class_name: Required[str] + """The exported class name of the Durable Object.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["durable_object_namespace"]] + """The kind of resource that the binding provides.""" + + environment: str + """The environment of the script_name to bind to.""" + + namespace_id: str + """Namespace identifier tag.""" + + script_name: str + """ + The script where the Durable Object is defined, if it is external to this + Worker. + """ + + +class MetadataBindingWorkersBindingKindHyperdrive(TypedDict, total=False): + id: Required[str] + """Identifier of the Hyperdrive connection to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["hyperdrive"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindJson(TypedDict, total=False): + json: Required[str] + """JSON data to use.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["json"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindKVNamespace(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + namespace_id: Required[str] + """Namespace identifier tag.""" + + type: Required[Literal["kv_namespace"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindMTLSCERT(TypedDict, total=False): + certificate_id: Required[str] + """Identifier of the certificate to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["mtls_certificate"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindPlainText(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + text: Required[str] + """The text value to use.""" + + type: Required[Literal["plain_text"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindQueue(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + queue_name: Required[str] + """Name of the Queue to bind to.""" + + type: Required[Literal["queue"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindR2(TypedDict, total=False): + bucket_name: Required[str] + """R2 bucket to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["r2_bucket"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindSecret(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + text: Required[str] + """The secret value to use.""" + + type: Required[Literal["secret_text"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindService(TypedDict, total=False): + environment: Required[str] + """Optional environment if the Worker utilizes one.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + service: Required[str] + """Name of Worker to bind to.""" + + type: Required[Literal["service"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindTailConsumer(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + service: Required[str] + """Name of Tail Worker to bind to.""" + + type: Required[Literal["tail_consumer"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindVectorize(TypedDict, total=False): + index_name: Required[str] + """Name of the Vectorize index to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["vectorize"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindVersionMetadata(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["version_metadata"]] + """The kind of resource that the binding provides.""" + + +MetadataBinding: TypeAlias = Union[ + MetadataBindingWorkersBindingKindAny, + MetadataBindingWorkersBindingKindAI, + MetadataBindingWorkersBindingKindAnalyticsEngine, + MetadataBindingWorkersBindingKindAssets, + MetadataBindingWorkersBindingKindBrowserRendering, + MetadataBindingWorkersBindingKindD1, + MetadataBindingWorkersBindingKindDispatchNamespace, + MetadataBindingWorkersBindingKindDo, + MetadataBindingWorkersBindingKindHyperdrive, + MetadataBindingWorkersBindingKindJson, + MetadataBindingWorkersBindingKindKVNamespace, + MetadataBindingWorkersBindingKindMTLSCERT, + MetadataBindingWorkersBindingKindPlainText, + MetadataBindingWorkersBindingKindQueue, + MetadataBindingWorkersBindingKindR2, + MetadataBindingWorkersBindingKindSecret, + MetadataBindingWorkersBindingKindService, + MetadataBindingWorkersBindingKindTailConsumer, + MetadataBindingWorkersBindingKindVectorize, + MetadataBindingWorkersBindingKindVersionMetadata, +] + + +class MetadataMigrationsWorkersMultipleStepMigrations(TypedDict, total=False): + new_tag: str + """Tag to set as the latest migration tag.""" + + old_tag: str + """Tag used to verify against the latest migration tag for this Worker. + + If they don't match, the upload is rejected. """ + steps: Iterable[MigrationStepParam] + """Migrations to apply in order.""" -Variant0MetadataBinding: TypeAlias = Union[Variant0MetadataBindingTyped, Dict[str, object]] -Variant0MetadataMigrations: TypeAlias = Union[SingleStepMigrationParam, SteppedMigrationParam] +MetadataMigrations: TypeAlias = Union[SingleStepMigrationParam, MetadataMigrationsWorkersMultipleStepMigrations] -class Variant0MetadataObservability(TypedDict, total=False): +class MetadataObservability(TypedDict, total=False): enabled: Required[bool] """Whether observability is enabled for the Worker.""" @@ -104,12 +375,24 @@ class Variant0MetadataObservability(TypedDict, total=False): """ -class Variant0Metadata(TypedDict, total=False): - assets: Variant0MetadataAssets +class MetadataPlacement(TypedDict, total=False): + mode: Literal["smart"] + """ + Enables + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ + + +class Metadata(TypedDict, total=False): + assets: MetadataAssets """Configuration for assets within a Worker""" - bindings: Iterable[Variant0MetadataBinding] - """List of bindings available to the worker.""" + bindings: Iterable[MetadataBinding] + """List of bindings attached to a Worker. + + You can find more about bindings on our docs: + https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings. + """ body_part: str """Name of the part in the multipart request that contains the script (e.g. @@ -150,13 +433,17 @@ class Variant0Metadata(TypedDict, total=False): the file exporting a `fetch` handler). Indicates a `module syntax` Worker. """ - migrations: Variant0MetadataMigrations + migrations: MetadataMigrations """Migrations to apply for Durable Objects associated with this Worker.""" - observability: Variant0MetadataObservability + observability: MetadataObservability """Observability settings for the Worker.""" - placement: PlacementConfigurationParam + placement: MetadataPlacement + """ + Configuration for + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ tags: List[str] """List of strings to use as tags for this Worker.""" @@ -164,30 +451,5 @@ class Variant0Metadata(TypedDict, total=False): tail_consumers: Iterable[ConsumerScriptParam] """List of Workers that will consume logs from the attached Worker.""" - usage_model: Literal["bundled", "unbound"] - """Usage model to apply to invocations.""" - - version_tags: Dict[str, str] - """Key-value pairs to use as tags for this version of this Worker.""" - - -class Variant1(TypedDict, total=False): - account_id: Required[str] - """Identifier""" - - rollback_to: str - """Rollback to provided deployment based on deployment ID. - - Request body will only parse a "message" part. You can learn more about - deployments - [here](https://developers.cloudflare.com/workers/platform/deployments/). - """ - - message: str - """Rollback message to be associated with this deployment. - - Only parsed when query param `"rollback_to"` is present. - """ - - -ScriptUpdateParams: TypeAlias = Union[Variant0, Variant1] + usage_model: Literal["standard"] + """Usage model for the Worker invocations.""" diff --git a/src/cloudflare/types/workers/script_update_response.py b/src/cloudflare/types/workers/script_update_response.py index b677f246eda..53d735b8638 100644 --- a/src/cloudflare/types/workers/script_update_response.py +++ b/src/cloudflare/types/workers/script_update_response.py @@ -2,11 +2,26 @@ from typing import List, Optional from datetime import datetime +from typing_extensions import Literal from ..._models import BaseModel from .scripts.consumer_script import ConsumerScript -__all__ = ["ScriptUpdateResponse"] +__all__ = ["ScriptUpdateResponse", "Placement"] + + +class Placement(BaseModel): + mode: Optional[Literal["smart"]] = None + """ + Enables + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ + + status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]] = None + """ + Status of + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ class ScriptUpdateResponse(BaseModel): @@ -31,13 +46,28 @@ class ScriptUpdateResponse(BaseModel): modified_on: Optional[datetime] = None """When the script was last modified.""" - placement_mode: Optional[str] = None - """Specifies the placement mode for the Worker (e.g. 'smart').""" + placement: Optional[Placement] = None + """ + Configuration for + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ + + placement_mode: Optional[Literal["smart"]] = None + """ + Enables + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ + + placement_status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]] = None + """ + Status of + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ startup_time_ms: Optional[int] = None tail_consumers: Optional[List[ConsumerScript]] = None """List of Workers that will consume logs from the attached Worker.""" - usage_model: Optional[str] = None - """Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound').""" + usage_model: Optional[Literal["standard"]] = None + """Usage model for the Worker invocations.""" diff --git a/src/cloudflare/types/workers/scripts/content_update_params.py b/src/cloudflare/types/workers/scripts/content_update_params.py index f5c5e96e343..4228706762e 100644 --- a/src/cloudflare/types/workers/scripts/content_update_params.py +++ b/src/cloudflare/types/workers/scripts/content_update_params.py @@ -2,10 +2,8 @@ from __future__ import annotations -from typing import List from typing_extensions import Required, Annotated, TypedDict -from ...._types import FileTypes from ...._utils import PropertyInfo from ..worker_metadata_param import WorkerMetadataParam @@ -16,18 +14,7 @@ class ContentUpdateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - any_part_name: Annotated[List[FileTypes], PropertyInfo(alias="")] - """A module comprising a Worker script, often a javascript file. - - Multiple modules may be provided as separate named parts, but at least one - module must be present. This should be referenced either in the metadata as - `main_module` (esm)/`body_part` (service worker) or as a header - `CF-WORKER-MAIN-MODULE-PART` (esm) /`CF-WORKER-BODY-PART` (service worker) by - part name. Source maps may also be included using the `application/source-map` - content type. - """ - - metadata: WorkerMetadataParam + metadata: Required[WorkerMetadataParam] """JSON encoded metadata about the uploaded parts and Worker configuration.""" cf_worker_body_part: Annotated[str, PropertyInfo(alias="CF-WORKER-BODY-PART")] diff --git a/src/cloudflare/types/workers/scripts/version_create_params.py b/src/cloudflare/types/workers/scripts/version_create_params.py index a80b0f876e9..ea793046aa2 100644 --- a/src/cloudflare/types/workers/scripts/version_create_params.py +++ b/src/cloudflare/types/workers/scripts/version_create_params.py @@ -2,27 +2,46 @@ from __future__ import annotations -from typing import List, Iterable -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing import Dict, List, Union, Iterable +from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict -from ...._types import FileTypes from ...._utils import PropertyInfo -__all__ = ["VersionCreateParams", "Metadata", "MetadataAnnotations"] +__all__ = [ + "VersionCreateParams", + "Metadata", + "MetadataAnnotations", + "MetadataBinding", + "MetadataBindingWorkersBindingKindAny", + "MetadataBindingWorkersBindingKindAI", + "MetadataBindingWorkersBindingKindAnalyticsEngine", + "MetadataBindingWorkersBindingKindAssets", + "MetadataBindingWorkersBindingKindBrowserRendering", + "MetadataBindingWorkersBindingKindD1", + "MetadataBindingWorkersBindingKindDispatchNamespace", + "MetadataBindingWorkersBindingKindDispatchNamespaceOutbound", + "MetadataBindingWorkersBindingKindDispatchNamespaceOutboundWorker", + "MetadataBindingWorkersBindingKindDo", + "MetadataBindingWorkersBindingKindHyperdrive", + "MetadataBindingWorkersBindingKindJson", + "MetadataBindingWorkersBindingKindKVNamespace", + "MetadataBindingWorkersBindingKindMTLSCERT", + "MetadataBindingWorkersBindingKindPlainText", + "MetadataBindingWorkersBindingKindQueue", + "MetadataBindingWorkersBindingKindR2", + "MetadataBindingWorkersBindingKindSecret", + "MetadataBindingWorkersBindingKindService", + "MetadataBindingWorkersBindingKindTailConsumer", + "MetadataBindingWorkersBindingKindVectorize", + "MetadataBindingWorkersBindingKindVersionMetadata", +] class VersionCreateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - any_part_name: Annotated[List[FileTypes], PropertyInfo(alias="")] - """A module comprising a Worker script, often a javascript file. - - Multiple modules may be provided as separate named parts, but at least one - module must be present and referenced in the metadata as `main_module`. - """ - - metadata: Metadata + metadata: Required[Metadata] """JSON encoded metadata about the uploaded parts and Worker configuration.""" @@ -34,11 +53,291 @@ class MetadataAnnotations(TypedDict, total=False): """User-provided identifier for the version.""" +class MetadataBindingWorkersBindingKindAnyTyped(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[str] + """The kind of resource that the binding provides.""" + + +MetadataBindingWorkersBindingKindAny: TypeAlias = Union[MetadataBindingWorkersBindingKindAnyTyped, Dict[str, object]] + + +class MetadataBindingWorkersBindingKindAI(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["ai"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindAnalyticsEngine(TypedDict, total=False): + dataset: Required[str] + """The dataset name to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["analytics_engine"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindAssets(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["assets"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindBrowserRendering(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["browser_rendering"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindD1(TypedDict, total=False): + id: Required[str] + """Identifier of the D1 database to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["d1"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindDispatchNamespaceOutboundWorker(TypedDict, total=False): + environment: str + """Environment of the outbound worker.""" + + service: str + """Name of the outbound worker.""" + + +class MetadataBindingWorkersBindingKindDispatchNamespaceOutbound(TypedDict, total=False): + params: List[str] + """ + Pass information from the Dispatch Worker to the Outbound Worker through the + parameters. + """ + + worker: MetadataBindingWorkersBindingKindDispatchNamespaceOutboundWorker + """Outbound worker.""" + + +class MetadataBindingWorkersBindingKindDispatchNamespace(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + namespace: Required[str] + """Namespace to bind to.""" + + type: Required[Literal["dispatch_namespace"]] + """The kind of resource that the binding provides.""" + + outbound: MetadataBindingWorkersBindingKindDispatchNamespaceOutbound + """Outbound worker.""" + + +class MetadataBindingWorkersBindingKindDo(TypedDict, total=False): + class_name: Required[str] + """The exported class name of the Durable Object.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["durable_object_namespace"]] + """The kind of resource that the binding provides.""" + + environment: str + """The environment of the script_name to bind to.""" + + namespace_id: str + """Namespace identifier tag.""" + + script_name: str + """ + The script where the Durable Object is defined, if it is external to this + Worker. + """ + + +class MetadataBindingWorkersBindingKindHyperdrive(TypedDict, total=False): + id: Required[str] + """Identifier of the Hyperdrive connection to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["hyperdrive"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindJson(TypedDict, total=False): + json: Required[str] + """JSON data to use.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["json"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindKVNamespace(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + namespace_id: Required[str] + """Namespace identifier tag.""" + + type: Required[Literal["kv_namespace"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindMTLSCERT(TypedDict, total=False): + certificate_id: Required[str] + """Identifier of the certificate to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["mtls_certificate"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindPlainText(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + text: Required[str] + """The text value to use.""" + + type: Required[Literal["plain_text"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindQueue(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + queue_name: Required[str] + """Name of the Queue to bind to.""" + + type: Required[Literal["queue"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindR2(TypedDict, total=False): + bucket_name: Required[str] + """R2 bucket to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["r2_bucket"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindSecret(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + text: Required[str] + """The secret value to use.""" + + type: Required[Literal["secret_text"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindService(TypedDict, total=False): + environment: Required[str] + """Optional environment if the Worker utilizes one.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + service: Required[str] + """Name of Worker to bind to.""" + + type: Required[Literal["service"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindTailConsumer(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + service: Required[str] + """Name of Tail Worker to bind to.""" + + type: Required[Literal["tail_consumer"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindVectorize(TypedDict, total=False): + index_name: Required[str] + """Name of the Vectorize index to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["vectorize"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindVersionMetadata(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["version_metadata"]] + """The kind of resource that the binding provides.""" + + +MetadataBinding: TypeAlias = Union[ + MetadataBindingWorkersBindingKindAny, + MetadataBindingWorkersBindingKindAI, + MetadataBindingWorkersBindingKindAnalyticsEngine, + MetadataBindingWorkersBindingKindAssets, + MetadataBindingWorkersBindingKindBrowserRendering, + MetadataBindingWorkersBindingKindD1, + MetadataBindingWorkersBindingKindDispatchNamespace, + MetadataBindingWorkersBindingKindDo, + MetadataBindingWorkersBindingKindHyperdrive, + MetadataBindingWorkersBindingKindJson, + MetadataBindingWorkersBindingKindKVNamespace, + MetadataBindingWorkersBindingKindMTLSCERT, + MetadataBindingWorkersBindingKindPlainText, + MetadataBindingWorkersBindingKindQueue, + MetadataBindingWorkersBindingKindR2, + MetadataBindingWorkersBindingKindSecret, + MetadataBindingWorkersBindingKindService, + MetadataBindingWorkersBindingKindTailConsumer, + MetadataBindingWorkersBindingKindVectorize, + MetadataBindingWorkersBindingKindVersionMetadata, +] + + class Metadata(TypedDict, total=False): + main_module: Required[str] + """Name of the part in the multipart request that contains the main module (e.g. + + the file exporting a `fetch` handler). Indicates a `module syntax` Worker, which + is required for Version Upload. + """ + annotations: MetadataAnnotations - bindings: Iterable[object] - """List of bindings available to the worker.""" + bindings: Iterable[MetadataBinding] + """List of bindings attached to a Worker. + + You can find more about bindings on our docs: + https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings. + """ compatibility_date: str """Date indicating targeted support in the Workers runtime. @@ -57,11 +356,5 @@ class Metadata(TypedDict, total=False): keep_bindings: List[str] """List of binding types to keep from previous_upload.""" - main_module: str - """Name of the part in the multipart request that contains the main module (e.g. - - the file exporting a `fetch` handler). Indicates a `module syntax` Worker. - """ - usage_model: Literal["standard"] - """Usage model to apply to invocations.""" + """Usage model for the Worker invocations.""" diff --git a/src/cloudflare/types/workers/service_binding.py b/src/cloudflare/types/workers/service_binding.py deleted file mode 100644 index ffd0c7b07f5..00000000000 --- a/src/cloudflare/types/workers/service_binding.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["ServiceBinding"] - - -class ServiceBinding(BaseModel): - environment: str - """Optional environment if the Worker utilizes one.""" - - name: str - """A JavaScript variable name for the binding.""" - - service: str - """Name of Worker to bind to""" - - type: Literal["service"] - """The class of resource that the binding provides.""" diff --git a/src/cloudflare/types/workers/service_binding_param.py b/src/cloudflare/types/workers/service_binding_param.py deleted file mode 100644 index 52ecb335075..00000000000 --- a/src/cloudflare/types/workers/service_binding_param.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["ServiceBindingParam"] - - -class ServiceBindingParam(TypedDict, total=False): - environment: Required[str] - """Optional environment if the Worker utilizes one.""" - - service: Required[str] - """Name of Worker to bind to""" - - type: Required[Literal["service"]] - """The class of resource that the binding provides.""" diff --git a/src/cloudflare/types/workers/stepped_migration.py b/src/cloudflare/types/workers/stepped_migration.py deleted file mode 100644 index 3383a9a473f..00000000000 --- a/src/cloudflare/types/workers/stepped_migration.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel -from .migration_step import MigrationStep - -__all__ = ["SteppedMigration"] - - -class SteppedMigration(BaseModel): - new_tag: Optional[str] = None - """Tag to set as the latest migration tag.""" - - old_tag: Optional[str] = None - """Tag used to verify against the latest migration tag for this Worker. - - If they don't match, the upload is rejected. - """ - - steps: Optional[List[MigrationStep]] = None - """Migrations to apply in order.""" diff --git a/src/cloudflare/types/workers/stepped_migration_param.py b/src/cloudflare/types/workers/stepped_migration_param.py deleted file mode 100644 index 2465041142b..00000000000 --- a/src/cloudflare/types/workers/stepped_migration_param.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable -from typing_extensions import TypedDict - -from .migration_step_param import MigrationStepParam - -__all__ = ["SteppedMigrationParam"] - - -class SteppedMigrationParam(TypedDict, total=False): - new_tag: str - """Tag to set as the latest migration tag.""" - - old_tag: str - """Tag used to verify against the latest migration tag for this Worker. - - If they don't match, the upload is rejected. - """ - - steps: Iterable[MigrationStepParam] - """Migrations to apply in order.""" diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_params.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_params.py index 13d32321c3f..0470a9fe602 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_params.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_params.py @@ -3,49 +3,59 @@ from __future__ import annotations from typing import Dict, List, Union, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing_extensions import Literal, Required, TypeAlias, TypedDict -from ....._types import FileTypes -from ....._utils import PropertyInfo -from ....workers.stepped_migration_param import SteppedMigrationParam +from ....workers.migration_step_param import MigrationStepParam from ....workers.single_step_migration_param import SingleStepMigrationParam -from ....workers.placement_configuration_param import PlacementConfigurationParam from ....workers.scripts.consumer_script_param import ConsumerScriptParam __all__ = [ "ScriptUpdateParams", - "Variant0", - "Variant0Metadata", - "Variant0MetadataAssets", - "Variant0MetadataAssetsConfig", - "Variant0MetadataBinding", - "Variant0MetadataMigrations", - "Variant0MetadataObservability", - "Variant1", + "Metadata", + "MetadataAssets", + "MetadataAssetsConfig", + "MetadataBinding", + "MetadataBindingWorkersBindingKindAny", + "MetadataBindingWorkersBindingKindAI", + "MetadataBindingWorkersBindingKindAnalyticsEngine", + "MetadataBindingWorkersBindingKindAssets", + "MetadataBindingWorkersBindingKindBrowserRendering", + "MetadataBindingWorkersBindingKindD1", + "MetadataBindingWorkersBindingKindDispatchNamespace", + "MetadataBindingWorkersBindingKindDispatchNamespaceOutbound", + "MetadataBindingWorkersBindingKindDispatchNamespaceOutboundWorker", + "MetadataBindingWorkersBindingKindDo", + "MetadataBindingWorkersBindingKindHyperdrive", + "MetadataBindingWorkersBindingKindJson", + "MetadataBindingWorkersBindingKindKVNamespace", + "MetadataBindingWorkersBindingKindMTLSCERT", + "MetadataBindingWorkersBindingKindPlainText", + "MetadataBindingWorkersBindingKindQueue", + "MetadataBindingWorkersBindingKindR2", + "MetadataBindingWorkersBindingKindSecret", + "MetadataBindingWorkersBindingKindService", + "MetadataBindingWorkersBindingKindTailConsumer", + "MetadataBindingWorkersBindingKindVectorize", + "MetadataBindingWorkersBindingKindVersionMetadata", + "MetadataMigrations", + "MetadataMigrationsWorkersMultipleStepMigrations", + "MetadataObservability", + "MetadataPlacement", ] -class Variant0(TypedDict, total=False): +class ScriptUpdateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" dispatch_namespace: Required[str] """Name of the Workers for Platforms dispatch namespace.""" - any_part_name: Annotated[List[FileTypes], PropertyInfo(alias="")] - """A module comprising a Worker script, often a javascript file. - - Multiple modules may be provided as separate named parts, but at least one - module must be present and referenced in the metadata as `main_module` or - `body_part` by part name. Source maps may also be included using the - `application/source-map` content type. - """ - - metadata: Variant0Metadata + metadata: Required[Metadata] """JSON encoded metadata about the uploaded parts and Worker configuration.""" -class Variant0MetadataAssetsConfig(TypedDict, total=False): +class MetadataAssetsConfig(TypedDict, total=False): html_handling: Literal["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"] """Determines the redirects and rewrites of requests for HTML content.""" @@ -63,32 +73,301 @@ class Variant0MetadataAssetsConfig(TypedDict, total=False): """ -class Variant0MetadataAssets(TypedDict, total=False): - config: Variant0MetadataAssetsConfig +class MetadataAssets(TypedDict, total=False): + config: MetadataAssetsConfig """Configuration for assets within a Worker.""" jwt: str """Token provided upon successful upload of all files from a registered manifest.""" -class Variant0MetadataBindingTyped(TypedDict, total=False): - name: str - """Name of the binding variable.""" +class MetadataBindingWorkersBindingKindAnyTyped(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" - type: str - """Type of binding. + type: Required[str] + """The kind of resource that the binding provides.""" - You can find more about bindings on our docs: - https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings. + +MetadataBindingWorkersBindingKindAny: TypeAlias = Union[MetadataBindingWorkersBindingKindAnyTyped, Dict[str, object]] + + +class MetadataBindingWorkersBindingKindAI(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["ai"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindAnalyticsEngine(TypedDict, total=False): + dataset: Required[str] + """The dataset name to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["analytics_engine"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindAssets(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["assets"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindBrowserRendering(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["browser_rendering"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindD1(TypedDict, total=False): + id: Required[str] + """Identifier of the D1 database to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["d1"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindDispatchNamespaceOutboundWorker(TypedDict, total=False): + environment: str + """Environment of the outbound worker.""" + + service: str + """Name of the outbound worker.""" + + +class MetadataBindingWorkersBindingKindDispatchNamespaceOutbound(TypedDict, total=False): + params: List[str] + """ + Pass information from the Dispatch Worker to the Outbound Worker through the + parameters. + """ + + worker: MetadataBindingWorkersBindingKindDispatchNamespaceOutboundWorker + """Outbound worker.""" + + +class MetadataBindingWorkersBindingKindDispatchNamespace(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + namespace: Required[str] + """Namespace to bind to.""" + + type: Required[Literal["dispatch_namespace"]] + """The kind of resource that the binding provides.""" + + outbound: MetadataBindingWorkersBindingKindDispatchNamespaceOutbound + """Outbound worker.""" + + +class MetadataBindingWorkersBindingKindDo(TypedDict, total=False): + class_name: Required[str] + """The exported class name of the Durable Object.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["durable_object_namespace"]] + """The kind of resource that the binding provides.""" + + environment: str + """The environment of the script_name to bind to.""" + + namespace_id: str + """Namespace identifier tag.""" + + script_name: str """ + The script where the Durable Object is defined, if it is external to this + Worker. + """ + + +class MetadataBindingWorkersBindingKindHyperdrive(TypedDict, total=False): + id: Required[str] + """Identifier of the Hyperdrive connection to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["hyperdrive"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindJson(TypedDict, total=False): + json: Required[str] + """JSON data to use.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["json"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindKVNamespace(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + namespace_id: Required[str] + """Namespace identifier tag.""" + + type: Required[Literal["kv_namespace"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindMTLSCERT(TypedDict, total=False): + certificate_id: Required[str] + """Identifier of the certificate to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["mtls_certificate"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindPlainText(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + text: Required[str] + """The text value to use.""" -Variant0MetadataBinding: TypeAlias = Union[Variant0MetadataBindingTyped, Dict[str, object]] + type: Required[Literal["plain_text"]] + """The kind of resource that the binding provides.""" -Variant0MetadataMigrations: TypeAlias = Union[SingleStepMigrationParam, SteppedMigrationParam] +class MetadataBindingWorkersBindingKindQueue(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" -class Variant0MetadataObservability(TypedDict, total=False): + queue_name: Required[str] + """Name of the Queue to bind to.""" + + type: Required[Literal["queue"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindR2(TypedDict, total=False): + bucket_name: Required[str] + """R2 bucket to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["r2_bucket"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindSecret(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + text: Required[str] + """The secret value to use.""" + + type: Required[Literal["secret_text"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindService(TypedDict, total=False): + environment: Required[str] + """Optional environment if the Worker utilizes one.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + service: Required[str] + """Name of Worker to bind to.""" + + type: Required[Literal["service"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindTailConsumer(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + service: Required[str] + """Name of Tail Worker to bind to.""" + + type: Required[Literal["tail_consumer"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindVectorize(TypedDict, total=False): + index_name: Required[str] + """Name of the Vectorize index to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["vectorize"]] + """The kind of resource that the binding provides.""" + + +class MetadataBindingWorkersBindingKindVersionMetadata(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["version_metadata"]] + """The kind of resource that the binding provides.""" + + +MetadataBinding: TypeAlias = Union[ + MetadataBindingWorkersBindingKindAny, + MetadataBindingWorkersBindingKindAI, + MetadataBindingWorkersBindingKindAnalyticsEngine, + MetadataBindingWorkersBindingKindAssets, + MetadataBindingWorkersBindingKindBrowserRendering, + MetadataBindingWorkersBindingKindD1, + MetadataBindingWorkersBindingKindDispatchNamespace, + MetadataBindingWorkersBindingKindDo, + MetadataBindingWorkersBindingKindHyperdrive, + MetadataBindingWorkersBindingKindJson, + MetadataBindingWorkersBindingKindKVNamespace, + MetadataBindingWorkersBindingKindMTLSCERT, + MetadataBindingWorkersBindingKindPlainText, + MetadataBindingWorkersBindingKindQueue, + MetadataBindingWorkersBindingKindR2, + MetadataBindingWorkersBindingKindSecret, + MetadataBindingWorkersBindingKindService, + MetadataBindingWorkersBindingKindTailConsumer, + MetadataBindingWorkersBindingKindVectorize, + MetadataBindingWorkersBindingKindVersionMetadata, +] + + +class MetadataMigrationsWorkersMultipleStepMigrations(TypedDict, total=False): + new_tag: str + """Tag to set as the latest migration tag.""" + + old_tag: str + """Tag used to verify against the latest migration tag for this Worker. + + If they don't match, the upload is rejected. + """ + + steps: Iterable[MigrationStepParam] + """Migrations to apply in order.""" + + +MetadataMigrations: TypeAlias = Union[SingleStepMigrationParam, MetadataMigrationsWorkersMultipleStepMigrations] + + +class MetadataObservability(TypedDict, total=False): enabled: Required[bool] """Whether observability is enabled for the Worker.""" @@ -99,12 +378,24 @@ class Variant0MetadataObservability(TypedDict, total=False): """ -class Variant0Metadata(TypedDict, total=False): - assets: Variant0MetadataAssets +class MetadataPlacement(TypedDict, total=False): + mode: Literal["smart"] + """ + Enables + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ + + +class Metadata(TypedDict, total=False): + assets: MetadataAssets """Configuration for assets within a Worker""" - bindings: Iterable[Variant0MetadataBinding] - """List of bindings available to the worker.""" + bindings: Iterable[MetadataBinding] + """List of bindings attached to a Worker. + + You can find more about bindings on our docs: + https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings. + """ body_part: str """Name of the part in the multipart request that contains the script (e.g. @@ -145,13 +436,17 @@ class Variant0Metadata(TypedDict, total=False): the file exporting a `fetch` handler). Indicates a `module syntax` Worker. """ - migrations: Variant0MetadataMigrations + migrations: MetadataMigrations """Migrations to apply for Durable Objects associated with this Worker.""" - observability: Variant0MetadataObservability + observability: MetadataObservability """Observability settings for the Worker.""" - placement: PlacementConfigurationParam + placement: MetadataPlacement + """ + Configuration for + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ tags: List[str] """List of strings to use as tags for this Worker.""" @@ -159,25 +454,5 @@ class Variant0Metadata(TypedDict, total=False): tail_consumers: Iterable[ConsumerScriptParam] """List of Workers that will consume logs from the attached Worker.""" - usage_model: Literal["bundled", "unbound"] - """Usage model to apply to invocations.""" - - version_tags: Dict[str, str] - """Key-value pairs to use as tags for this version of this Worker.""" - - -class Variant1(TypedDict, total=False): - account_id: Required[str] - """Identifier""" - - dispatch_namespace: Required[str] - """Name of the Workers for Platforms dispatch namespace.""" - - message: str - """Rollback message to be associated with this deployment. - - Only parsed when query param `"rollback_to"` is present. - """ - - -ScriptUpdateParams: TypeAlias = Union[Variant0, Variant1] + usage_model: Literal["standard"] + """Usage model for the Worker invocations.""" diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_response.py index e4fd8cf4809..d79a5e9b267 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_response.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_response.py @@ -2,11 +2,26 @@ from typing import List, Optional from datetime import datetime +from typing_extensions import Literal from ....._models import BaseModel from ....workers.scripts.consumer_script import ConsumerScript -__all__ = ["ScriptUpdateResponse"] +__all__ = ["ScriptUpdateResponse", "Placement"] + + +class Placement(BaseModel): + mode: Optional[Literal["smart"]] = None + """ + Enables + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ + + status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]] = None + """ + Status of + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ class ScriptUpdateResponse(BaseModel): @@ -31,13 +46,28 @@ class ScriptUpdateResponse(BaseModel): modified_on: Optional[datetime] = None """When the script was last modified.""" - placement_mode: Optional[str] = None - """Specifies the placement mode for the Worker (e.g. 'smart').""" + placement: Optional[Placement] = None + """ + Configuration for + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ + + placement_mode: Optional[Literal["smart"]] = None + """ + Enables + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ + + placement_status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]] = None + """ + Status of + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ startup_time_ms: Optional[int] = None tail_consumers: Optional[List[ConsumerScript]] = None """List of Workers that will consume logs from the attached Worker.""" - usage_model: Optional[str] = None - """Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound').""" + usage_model: Optional[Literal["standard"]] = None + """Usage model for the Worker invocations.""" diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/__init__.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/__init__.py index b1e6bf59e47..b1d4cb724c8 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/__init__.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/__init__.py @@ -14,3 +14,5 @@ from .content_update_params import ContentUpdateParams as ContentUpdateParams from .setting_edit_response import SettingEditResponse as SettingEditResponse from .secret_update_response import SecretUpdateResponse as SecretUpdateResponse +from .asset_upload_create_params import AssetUploadCreateParams as AssetUploadCreateParams +from .asset_upload_create_response import AssetUploadCreateResponse as AssetUploadCreateResponse diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/asset_upload_create_params.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/asset_upload_create_params.py new file mode 100644 index 00000000000..83870f01ad2 --- /dev/null +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/asset_upload_create_params.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict +from typing_extensions import Required, TypedDict + +__all__ = ["AssetUploadCreateParams", "Manifest"] + + +class AssetUploadCreateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + dispatch_namespace: Required[str] + """Name of the Workers for Platforms dispatch namespace.""" + + manifest: Dict[str, Manifest] + """A manifest ([path]: {hash, size}) map of files to upload. + + As an example, `/blog/hello-world.html` would be a valid path key. + """ + + +class Manifest(TypedDict, total=False): + hash: str + """The hash of the file.""" + + size: int + """The size of the file in bytes.""" diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/asset_upload_create_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/asset_upload_create_response.py new file mode 100644 index 00000000000..e25a814291a --- /dev/null +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/asset_upload_create_response.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ......_models import BaseModel + +__all__ = ["AssetUploadCreateResponse"] + + +class AssetUploadCreateResponse(BaseModel): + buckets: Optional[List[List[str]]] = None + """The requests to make to upload assets.""" + + jwt: Optional[str] = None + """A JWT to use as authentication for uploading assets.""" diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/binding_get_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/binding_get_response.py index b7a3d0c673f..c347a833b16 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/binding_get_response.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/binding_get_response.py @@ -1,10 +1,309 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List -from typing_extensions import TypeAlias +from typing import TYPE_CHECKING, List, Union, Optional +from typing_extensions import Literal, TypeAlias -from .....workers.binding import Binding +from pydantic import Field as FieldInfo -__all__ = ["BindingGetResponse"] +from ......_models import BaseModel -BindingGetResponse: TypeAlias = List[Binding] +__all__ = [ + "BindingGetResponse", + "BindingGetResponseItem", + "BindingGetResponseItemWorkersBindingKindAny", + "BindingGetResponseItemWorkersBindingKindAI", + "BindingGetResponseItemWorkersBindingKindAnalyticsEngine", + "BindingGetResponseItemWorkersBindingKindAssets", + "BindingGetResponseItemWorkersBindingKindBrowserRendering", + "BindingGetResponseItemWorkersBindingKindD1", + "BindingGetResponseItemWorkersBindingKindDispatchNamespace", + "BindingGetResponseItemWorkersBindingKindDispatchNamespaceOutbound", + "BindingGetResponseItemWorkersBindingKindDispatchNamespaceOutboundWorker", + "BindingGetResponseItemWorkersBindingKindDo", + "BindingGetResponseItemWorkersBindingKindHyperdrive", + "BindingGetResponseItemWorkersBindingKindJson", + "BindingGetResponseItemWorkersBindingKindKVNamespace", + "BindingGetResponseItemWorkersBindingKindMTLSCERT", + "BindingGetResponseItemWorkersBindingKindPlainText", + "BindingGetResponseItemWorkersBindingKindQueue", + "BindingGetResponseItemWorkersBindingKindR2", + "BindingGetResponseItemWorkersBindingKindSecret", + "BindingGetResponseItemWorkersBindingKindService", + "BindingGetResponseItemWorkersBindingKindTailConsumer", + "BindingGetResponseItemWorkersBindingKindVectorize", + "BindingGetResponseItemWorkersBindingKindVersionMetadata", +] + + +class BindingGetResponseItemWorkersBindingKindAny(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + type: str + """The kind of resource that the binding provides.""" + + if TYPE_CHECKING: + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + + +class BindingGetResponseItemWorkersBindingKindAI(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["ai"] + """The kind of resource that the binding provides.""" + + +class BindingGetResponseItemWorkersBindingKindAnalyticsEngine(BaseModel): + dataset: str + """The dataset name to bind to.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["analytics_engine"] + """The kind of resource that the binding provides.""" + + +class BindingGetResponseItemWorkersBindingKindAssets(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["assets"] + """The kind of resource that the binding provides.""" + + +class BindingGetResponseItemWorkersBindingKindBrowserRendering(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["browser_rendering"] + """The kind of resource that the binding provides.""" + + +class BindingGetResponseItemWorkersBindingKindD1(BaseModel): + id: str + """Identifier of the D1 database to bind to.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["d1"] + """The kind of resource that the binding provides.""" + + +class BindingGetResponseItemWorkersBindingKindDispatchNamespaceOutboundWorker(BaseModel): + environment: Optional[str] = None + """Environment of the outbound worker.""" + + service: Optional[str] = None + """Name of the outbound worker.""" + + +class BindingGetResponseItemWorkersBindingKindDispatchNamespaceOutbound(BaseModel): + params: Optional[List[str]] = None + """ + Pass information from the Dispatch Worker to the Outbound Worker through the + parameters. + """ + + worker: Optional[BindingGetResponseItemWorkersBindingKindDispatchNamespaceOutboundWorker] = None + """Outbound worker.""" + + +class BindingGetResponseItemWorkersBindingKindDispatchNamespace(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + namespace: str + """Namespace to bind to.""" + + type: Literal["dispatch_namespace"] + """The kind of resource that the binding provides.""" + + outbound: Optional[BindingGetResponseItemWorkersBindingKindDispatchNamespaceOutbound] = None + """Outbound worker.""" + + +class BindingGetResponseItemWorkersBindingKindDo(BaseModel): + class_name: str + """The exported class name of the Durable Object.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["durable_object_namespace"] + """The kind of resource that the binding provides.""" + + environment: Optional[str] = None + """The environment of the script_name to bind to.""" + + namespace_id: Optional[str] = None + """Namespace identifier tag.""" + + script_name: Optional[str] = None + """ + The script where the Durable Object is defined, if it is external to this + Worker. + """ + + +class BindingGetResponseItemWorkersBindingKindHyperdrive(BaseModel): + id: str + """Identifier of the Hyperdrive connection to bind to.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["hyperdrive"] + """The kind of resource that the binding provides.""" + + +class BindingGetResponseItemWorkersBindingKindJson(BaseModel): + json_: str = FieldInfo(alias="json") + """JSON data to use.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["json"] + """The kind of resource that the binding provides.""" + + +class BindingGetResponseItemWorkersBindingKindKVNamespace(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + namespace_id: str + """Namespace identifier tag.""" + + type: Literal["kv_namespace"] + """The kind of resource that the binding provides.""" + + +class BindingGetResponseItemWorkersBindingKindMTLSCERT(BaseModel): + certificate_id: str + """Identifier of the certificate to bind to.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["mtls_certificate"] + """The kind of resource that the binding provides.""" + + +class BindingGetResponseItemWorkersBindingKindPlainText(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + text: str + """The text value to use.""" + + type: Literal["plain_text"] + """The kind of resource that the binding provides.""" + + +class BindingGetResponseItemWorkersBindingKindQueue(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + queue_name: str + """Name of the Queue to bind to.""" + + type: Literal["queue"] + """The kind of resource that the binding provides.""" + + +class BindingGetResponseItemWorkersBindingKindR2(BaseModel): + bucket_name: str + """R2 bucket to bind to.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["r2_bucket"] + """The kind of resource that the binding provides.""" + + +class BindingGetResponseItemWorkersBindingKindSecret(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + text: str + """The secret value to use.""" + + type: Literal["secret_text"] + """The kind of resource that the binding provides.""" + + +class BindingGetResponseItemWorkersBindingKindService(BaseModel): + environment: str + """Optional environment if the Worker utilizes one.""" + + name: str + """A JavaScript variable name for the binding.""" + + service: str + """Name of Worker to bind to.""" + + type: Literal["service"] + """The kind of resource that the binding provides.""" + + +class BindingGetResponseItemWorkersBindingKindTailConsumer(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + service: str + """Name of Tail Worker to bind to.""" + + type: Literal["tail_consumer"] + """The kind of resource that the binding provides.""" + + +class BindingGetResponseItemWorkersBindingKindVectorize(BaseModel): + index_name: str + """Name of the Vectorize index to bind to.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["vectorize"] + """The kind of resource that the binding provides.""" + + +class BindingGetResponseItemWorkersBindingKindVersionMetadata(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["version_metadata"] + """The kind of resource that the binding provides.""" + + +BindingGetResponseItem: TypeAlias = Union[ + BindingGetResponseItemWorkersBindingKindAny, + BindingGetResponseItemWorkersBindingKindAI, + BindingGetResponseItemWorkersBindingKindAnalyticsEngine, + BindingGetResponseItemWorkersBindingKindAssets, + BindingGetResponseItemWorkersBindingKindBrowserRendering, + BindingGetResponseItemWorkersBindingKindD1, + BindingGetResponseItemWorkersBindingKindDispatchNamespace, + BindingGetResponseItemWorkersBindingKindDo, + BindingGetResponseItemWorkersBindingKindHyperdrive, + BindingGetResponseItemWorkersBindingKindJson, + BindingGetResponseItemWorkersBindingKindKVNamespace, + BindingGetResponseItemWorkersBindingKindMTLSCERT, + BindingGetResponseItemWorkersBindingKindPlainText, + BindingGetResponseItemWorkersBindingKindQueue, + BindingGetResponseItemWorkersBindingKindR2, + BindingGetResponseItemWorkersBindingKindSecret, + BindingGetResponseItemWorkersBindingKindService, + BindingGetResponseItemWorkersBindingKindTailConsumer, + BindingGetResponseItemWorkersBindingKindVectorize, + BindingGetResponseItemWorkersBindingKindVersionMetadata, +] + +BindingGetResponse: TypeAlias = List[BindingGetResponseItem] diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_params.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_params.py index 9f4d3118469..84e1916a5ef 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_params.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_params.py @@ -2,10 +2,8 @@ from __future__ import annotations -from typing import List from typing_extensions import Required, Annotated, TypedDict -from ......_types import FileTypes from ......_utils import PropertyInfo from .....workers.worker_metadata_param import WorkerMetadataParam @@ -19,18 +17,7 @@ class ContentUpdateParams(TypedDict, total=False): dispatch_namespace: Required[str] """Name of the Workers for Platforms dispatch namespace.""" - any_part_name: Annotated[List[FileTypes], PropertyInfo(alias="")] - """A module comprising a Worker script, often a javascript file. - - Multiple modules may be provided as separate named parts, but at least one - module must be present. This should be referenced either in the metadata as - `main_module` (esm)/`body_part` (service worker) or as a header - `CF-WORKER-MAIN-MODULE-PART` (esm) /`CF-WORKER-BODY-PART` (service worker) by - part name. Source maps may also be included using the `application/source-map` - content type. - """ - - metadata: WorkerMetadataParam + metadata: Required[WorkerMetadataParam] """JSON encoded metadata about the uploaded parts and Worker configuration.""" cf_worker_body_part: Annotated[str, PropertyInfo(alias="CF-WORKER-BODY-PART")] diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_params.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_params.py index f7e8aedcdf9..cfb478bb1c8 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_params.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_params.py @@ -2,16 +2,45 @@ from __future__ import annotations -from typing import List, Union, Iterable, Optional -from typing_extensions import Required, TypeAlias, TypedDict +from typing import Dict, List, Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict -from .....workers.binding_param import BindingParam -from .....workers.stepped_migration_param import SteppedMigrationParam +from .....workers.migration_step_param import MigrationStepParam from .....workers.single_step_migration_param import SingleStepMigrationParam -from .....workers.placement_configuration_param import PlacementConfigurationParam from .....workers.scripts.consumer_script_param import ConsumerScriptParam -__all__ = ["SettingEditParams", "Settings", "SettingsLimits", "SettingsMigrations", "SettingsObservability"] +__all__ = [ + "SettingEditParams", + "Settings", + "SettingsBinding", + "SettingsBindingWorkersBindingKindAny", + "SettingsBindingWorkersBindingKindAI", + "SettingsBindingWorkersBindingKindAnalyticsEngine", + "SettingsBindingWorkersBindingKindAssets", + "SettingsBindingWorkersBindingKindBrowserRendering", + "SettingsBindingWorkersBindingKindD1", + "SettingsBindingWorkersBindingKindDispatchNamespace", + "SettingsBindingWorkersBindingKindDispatchNamespaceOutbound", + "SettingsBindingWorkersBindingKindDispatchNamespaceOutboundWorker", + "SettingsBindingWorkersBindingKindDo", + "SettingsBindingWorkersBindingKindHyperdrive", + "SettingsBindingWorkersBindingKindJson", + "SettingsBindingWorkersBindingKindKVNamespace", + "SettingsBindingWorkersBindingKindMTLSCERT", + "SettingsBindingWorkersBindingKindPlainText", + "SettingsBindingWorkersBindingKindQueue", + "SettingsBindingWorkersBindingKindR2", + "SettingsBindingWorkersBindingKindSecret", + "SettingsBindingWorkersBindingKindService", + "SettingsBindingWorkersBindingKindTailConsumer", + "SettingsBindingWorkersBindingKindVectorize", + "SettingsBindingWorkersBindingKindVersionMetadata", + "SettingsLimits", + "SettingsMigrations", + "SettingsMigrationsWorkersMultipleStepMigrations", + "SettingsObservability", + "SettingsPlacement", +] class SettingEditParams(TypedDict, total=False): @@ -24,12 +53,295 @@ class SettingEditParams(TypedDict, total=False): settings: Settings +class SettingsBindingWorkersBindingKindAnyTyped(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[str] + """The kind of resource that the binding provides.""" + + +SettingsBindingWorkersBindingKindAny: TypeAlias = Union[SettingsBindingWorkersBindingKindAnyTyped, Dict[str, object]] + + +class SettingsBindingWorkersBindingKindAI(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["ai"]] + """The kind of resource that the binding provides.""" + + +class SettingsBindingWorkersBindingKindAnalyticsEngine(TypedDict, total=False): + dataset: Required[str] + """The dataset name to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["analytics_engine"]] + """The kind of resource that the binding provides.""" + + +class SettingsBindingWorkersBindingKindAssets(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["assets"]] + """The kind of resource that the binding provides.""" + + +class SettingsBindingWorkersBindingKindBrowserRendering(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["browser_rendering"]] + """The kind of resource that the binding provides.""" + + +class SettingsBindingWorkersBindingKindD1(TypedDict, total=False): + id: Required[str] + """Identifier of the D1 database to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["d1"]] + """The kind of resource that the binding provides.""" + + +class SettingsBindingWorkersBindingKindDispatchNamespaceOutboundWorker(TypedDict, total=False): + environment: str + """Environment of the outbound worker.""" + + service: str + """Name of the outbound worker.""" + + +class SettingsBindingWorkersBindingKindDispatchNamespaceOutbound(TypedDict, total=False): + params: List[str] + """ + Pass information from the Dispatch Worker to the Outbound Worker through the + parameters. + """ + + worker: SettingsBindingWorkersBindingKindDispatchNamespaceOutboundWorker + """Outbound worker.""" + + +class SettingsBindingWorkersBindingKindDispatchNamespace(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + namespace: Required[str] + """Namespace to bind to.""" + + type: Required[Literal["dispatch_namespace"]] + """The kind of resource that the binding provides.""" + + outbound: SettingsBindingWorkersBindingKindDispatchNamespaceOutbound + """Outbound worker.""" + + +class SettingsBindingWorkersBindingKindDo(TypedDict, total=False): + class_name: Required[str] + """The exported class name of the Durable Object.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["durable_object_namespace"]] + """The kind of resource that the binding provides.""" + + environment: str + """The environment of the script_name to bind to.""" + + namespace_id: str + """Namespace identifier tag.""" + + script_name: str + """ + The script where the Durable Object is defined, if it is external to this + Worker. + """ + + +class SettingsBindingWorkersBindingKindHyperdrive(TypedDict, total=False): + id: Required[str] + """Identifier of the Hyperdrive connection to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["hyperdrive"]] + """The kind of resource that the binding provides.""" + + +class SettingsBindingWorkersBindingKindJson(TypedDict, total=False): + json: Required[str] + """JSON data to use.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["json"]] + """The kind of resource that the binding provides.""" + + +class SettingsBindingWorkersBindingKindKVNamespace(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + namespace_id: Required[str] + """Namespace identifier tag.""" + + type: Required[Literal["kv_namespace"]] + """The kind of resource that the binding provides.""" + + +class SettingsBindingWorkersBindingKindMTLSCERT(TypedDict, total=False): + certificate_id: Required[str] + """Identifier of the certificate to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["mtls_certificate"]] + """The kind of resource that the binding provides.""" + + +class SettingsBindingWorkersBindingKindPlainText(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + text: Required[str] + """The text value to use.""" + + type: Required[Literal["plain_text"]] + """The kind of resource that the binding provides.""" + + +class SettingsBindingWorkersBindingKindQueue(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + queue_name: Required[str] + """Name of the Queue to bind to.""" + + type: Required[Literal["queue"]] + """The kind of resource that the binding provides.""" + + +class SettingsBindingWorkersBindingKindR2(TypedDict, total=False): + bucket_name: Required[str] + """R2 bucket to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["r2_bucket"]] + """The kind of resource that the binding provides.""" + + +class SettingsBindingWorkersBindingKindSecret(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + text: Required[str] + """The secret value to use.""" + + type: Required[Literal["secret_text"]] + """The kind of resource that the binding provides.""" + + +class SettingsBindingWorkersBindingKindService(TypedDict, total=False): + environment: Required[str] + """Optional environment if the Worker utilizes one.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + service: Required[str] + """Name of Worker to bind to.""" + + type: Required[Literal["service"]] + """The kind of resource that the binding provides.""" + + +class SettingsBindingWorkersBindingKindTailConsumer(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + service: Required[str] + """Name of Tail Worker to bind to.""" + + type: Required[Literal["tail_consumer"]] + """The kind of resource that the binding provides.""" + + +class SettingsBindingWorkersBindingKindVectorize(TypedDict, total=False): + index_name: Required[str] + """Name of the Vectorize index to bind to.""" + + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["vectorize"]] + """The kind of resource that the binding provides.""" + + +class SettingsBindingWorkersBindingKindVersionMetadata(TypedDict, total=False): + name: Required[str] + """A JavaScript variable name for the binding.""" + + type: Required[Literal["version_metadata"]] + """The kind of resource that the binding provides.""" + + +SettingsBinding: TypeAlias = Union[ + SettingsBindingWorkersBindingKindAny, + SettingsBindingWorkersBindingKindAI, + SettingsBindingWorkersBindingKindAnalyticsEngine, + SettingsBindingWorkersBindingKindAssets, + SettingsBindingWorkersBindingKindBrowserRendering, + SettingsBindingWorkersBindingKindD1, + SettingsBindingWorkersBindingKindDispatchNamespace, + SettingsBindingWorkersBindingKindDo, + SettingsBindingWorkersBindingKindHyperdrive, + SettingsBindingWorkersBindingKindJson, + SettingsBindingWorkersBindingKindKVNamespace, + SettingsBindingWorkersBindingKindMTLSCERT, + SettingsBindingWorkersBindingKindPlainText, + SettingsBindingWorkersBindingKindQueue, + SettingsBindingWorkersBindingKindR2, + SettingsBindingWorkersBindingKindSecret, + SettingsBindingWorkersBindingKindService, + SettingsBindingWorkersBindingKindTailConsumer, + SettingsBindingWorkersBindingKindVectorize, + SettingsBindingWorkersBindingKindVersionMetadata, +] + + class SettingsLimits(TypedDict, total=False): cpu_ms: int """The amount of CPU time this Worker can use in milliseconds.""" -SettingsMigrations: TypeAlias = Union[SingleStepMigrationParam, SteppedMigrationParam] +class SettingsMigrationsWorkersMultipleStepMigrations(TypedDict, total=False): + new_tag: str + """Tag to set as the latest migration tag.""" + + old_tag: str + """Tag used to verify against the latest migration tag for this Worker. + + If they don't match, the upload is rejected. + """ + + steps: Iterable[MigrationStepParam] + """Migrations to apply in order.""" + + +SettingsMigrations: TypeAlias = Union[SingleStepMigrationParam, SettingsMigrationsWorkersMultipleStepMigrations] class SettingsObservability(TypedDict, total=False): @@ -43,15 +355,35 @@ class SettingsObservability(TypedDict, total=False): """ +class SettingsPlacement(TypedDict, total=False): + mode: Literal["smart"] + """ + Enables + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ + + class Settings(TypedDict, total=False): - bindings: Iterable[BindingParam] - """List of bindings attached to this Worker""" + bindings: Iterable[SettingsBinding] + """List of bindings attached to a Worker. + + You can find more about bindings on our docs: + https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings. + """ compatibility_date: str - """Opt your Worker into changes after this date""" + """Date indicating targeted support in the Workers runtime. + + Backwards incompatible fixes to the runtime following this date will not affect + this Worker. + """ compatibility_flags: List[str] - """Opt your Worker into specific changes""" + """Flags that enable or disable certain features in the Workers runtime. + + Used to enable upcoming features or opt in or out of specific changes not + included in a `compatibility_date`. + """ limits: SettingsLimits """Limits to apply for this Worker.""" @@ -65,7 +397,11 @@ class Settings(TypedDict, total=False): observability: SettingsObservability """Observability settings for the Worker.""" - placement: PlacementConfigurationParam + placement: SettingsPlacement + """ + Configuration for + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ tags: List[str] """Tags to help you manage your Workers""" @@ -73,5 +409,5 @@ class Settings(TypedDict, total=False): tail_consumers: Iterable[ConsumerScriptParam] """List of Workers that will consume logs from the attached Worker.""" - usage_model: str - """Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound').""" + usage_model: Literal["standard"] + """Usage model for the Worker invocations.""" diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_response.py index a5f8112d446..799ad01b712 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_response.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_response.py @@ -1,16 +1,318 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional -from typing_extensions import TypeAlias +from typing import TYPE_CHECKING, List, Union, Optional +from typing_extensions import Literal, TypeAlias + +from pydantic import Field as FieldInfo from ......_models import BaseModel -from .....workers.binding import Binding -from .....workers.stepped_migration import SteppedMigration +from .....workers.migration_step import MigrationStep from .....workers.single_step_migration import SingleStepMigration -from .....workers.placement_configuration import PlacementConfiguration from .....workers.scripts.consumer_script import ConsumerScript -__all__ = ["SettingEditResponse", "Limits", "Migrations", "Observability"] +__all__ = [ + "SettingEditResponse", + "Binding", + "BindingWorkersBindingKindAny", + "BindingWorkersBindingKindAI", + "BindingWorkersBindingKindAnalyticsEngine", + "BindingWorkersBindingKindAssets", + "BindingWorkersBindingKindBrowserRendering", + "BindingWorkersBindingKindD1", + "BindingWorkersBindingKindDispatchNamespace", + "BindingWorkersBindingKindDispatchNamespaceOutbound", + "BindingWorkersBindingKindDispatchNamespaceOutboundWorker", + "BindingWorkersBindingKindDo", + "BindingWorkersBindingKindHyperdrive", + "BindingWorkersBindingKindJson", + "BindingWorkersBindingKindKVNamespace", + "BindingWorkersBindingKindMTLSCERT", + "BindingWorkersBindingKindPlainText", + "BindingWorkersBindingKindQueue", + "BindingWorkersBindingKindR2", + "BindingWorkersBindingKindSecret", + "BindingWorkersBindingKindService", + "BindingWorkersBindingKindTailConsumer", + "BindingWorkersBindingKindVectorize", + "BindingWorkersBindingKindVersionMetadata", + "Limits", + "Migrations", + "MigrationsWorkersMultipleStepMigrations", + "Observability", + "Placement", +] + + +class BindingWorkersBindingKindAny(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + type: str + """The kind of resource that the binding provides.""" + + if TYPE_CHECKING: + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + + +class BindingWorkersBindingKindAI(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["ai"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindAnalyticsEngine(BaseModel): + dataset: str + """The dataset name to bind to.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["analytics_engine"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindAssets(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["assets"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindBrowserRendering(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["browser_rendering"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindD1(BaseModel): + id: str + """Identifier of the D1 database to bind to.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["d1"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindDispatchNamespaceOutboundWorker(BaseModel): + environment: Optional[str] = None + """Environment of the outbound worker.""" + + service: Optional[str] = None + """Name of the outbound worker.""" + + +class BindingWorkersBindingKindDispatchNamespaceOutbound(BaseModel): + params: Optional[List[str]] = None + """ + Pass information from the Dispatch Worker to the Outbound Worker through the + parameters. + """ + + worker: Optional[BindingWorkersBindingKindDispatchNamespaceOutboundWorker] = None + """Outbound worker.""" + + +class BindingWorkersBindingKindDispatchNamespace(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + namespace: str + """Namespace to bind to.""" + + type: Literal["dispatch_namespace"] + """The kind of resource that the binding provides.""" + + outbound: Optional[BindingWorkersBindingKindDispatchNamespaceOutbound] = None + """Outbound worker.""" + + +class BindingWorkersBindingKindDo(BaseModel): + class_name: str + """The exported class name of the Durable Object.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["durable_object_namespace"] + """The kind of resource that the binding provides.""" + + environment: Optional[str] = None + """The environment of the script_name to bind to.""" + + namespace_id: Optional[str] = None + """Namespace identifier tag.""" + + script_name: Optional[str] = None + """ + The script where the Durable Object is defined, if it is external to this + Worker. + """ + + +class BindingWorkersBindingKindHyperdrive(BaseModel): + id: str + """Identifier of the Hyperdrive connection to bind to.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["hyperdrive"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindJson(BaseModel): + json_: str = FieldInfo(alias="json") + """JSON data to use.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["json"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindKVNamespace(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + namespace_id: str + """Namespace identifier tag.""" + + type: Literal["kv_namespace"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindMTLSCERT(BaseModel): + certificate_id: str + """Identifier of the certificate to bind to.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["mtls_certificate"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindPlainText(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + text: str + """The text value to use.""" + + type: Literal["plain_text"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindQueue(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + queue_name: str + """Name of the Queue to bind to.""" + + type: Literal["queue"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindR2(BaseModel): + bucket_name: str + """R2 bucket to bind to.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["r2_bucket"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindSecret(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + text: str + """The secret value to use.""" + + type: Literal["secret_text"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindService(BaseModel): + environment: str + """Optional environment if the Worker utilizes one.""" + + name: str + """A JavaScript variable name for the binding.""" + + service: str + """Name of Worker to bind to.""" + + type: Literal["service"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindTailConsumer(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + service: str + """Name of Tail Worker to bind to.""" + + type: Literal["tail_consumer"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindVectorize(BaseModel): + index_name: str + """Name of the Vectorize index to bind to.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["vectorize"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindVersionMetadata(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["version_metadata"] + """The kind of resource that the binding provides.""" + + +Binding: TypeAlias = Union[ + BindingWorkersBindingKindAny, + BindingWorkersBindingKindAI, + BindingWorkersBindingKindAnalyticsEngine, + BindingWorkersBindingKindAssets, + BindingWorkersBindingKindBrowserRendering, + BindingWorkersBindingKindD1, + BindingWorkersBindingKindDispatchNamespace, + BindingWorkersBindingKindDo, + BindingWorkersBindingKindHyperdrive, + BindingWorkersBindingKindJson, + BindingWorkersBindingKindKVNamespace, + BindingWorkersBindingKindMTLSCERT, + BindingWorkersBindingKindPlainText, + BindingWorkersBindingKindQueue, + BindingWorkersBindingKindR2, + BindingWorkersBindingKindSecret, + BindingWorkersBindingKindService, + BindingWorkersBindingKindTailConsumer, + BindingWorkersBindingKindVectorize, + BindingWorkersBindingKindVersionMetadata, +] class Limits(BaseModel): @@ -18,7 +320,21 @@ class Limits(BaseModel): """The amount of CPU time this Worker can use in milliseconds.""" -Migrations: TypeAlias = Union[SingleStepMigration, SteppedMigration] +class MigrationsWorkersMultipleStepMigrations(BaseModel): + new_tag: Optional[str] = None + """Tag to set as the latest migration tag.""" + + old_tag: Optional[str] = None + """Tag used to verify against the latest migration tag for this Worker. + + If they don't match, the upload is rejected. + """ + + steps: Optional[List[MigrationStep]] = None + """Migrations to apply in order.""" + + +Migrations: TypeAlias = Union[SingleStepMigration, MigrationsWorkersMultipleStepMigrations] class Observability(BaseModel): @@ -32,15 +348,35 @@ class Observability(BaseModel): """ +class Placement(BaseModel): + mode: Optional[Literal["smart"]] = None + """ + Enables + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ + + class SettingEditResponse(BaseModel): bindings: Optional[List[Binding]] = None - """List of bindings attached to this Worker""" + """List of bindings attached to a Worker. + + You can find more about bindings on our docs: + https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings. + """ compatibility_date: Optional[str] = None - """Opt your Worker into changes after this date""" + """Date indicating targeted support in the Workers runtime. + + Backwards incompatible fixes to the runtime following this date will not affect + this Worker. + """ compatibility_flags: Optional[List[str]] = None - """Opt your Worker into specific changes""" + """Flags that enable or disable certain features in the Workers runtime. + + Used to enable upcoming features or opt in or out of specific changes not + included in a `compatibility_date`. + """ limits: Optional[Limits] = None """Limits to apply for this Worker.""" @@ -54,7 +390,11 @@ class SettingEditResponse(BaseModel): observability: Optional[Observability] = None """Observability settings for the Worker.""" - placement: Optional[PlacementConfiguration] = None + placement: Optional[Placement] = None + """ + Configuration for + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ tags: Optional[List[str]] = None """Tags to help you manage your Workers""" @@ -62,5 +402,5 @@ class SettingEditResponse(BaseModel): tail_consumers: Optional[List[ConsumerScript]] = None """List of Workers that will consume logs from the attached Worker.""" - usage_model: Optional[str] = None - """Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound').""" + usage_model: Optional[Literal["standard"]] = None + """Usage model for the Worker invocations.""" diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_get_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_get_response.py index 8e7516ccf3d..e6a39d1e9af 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_get_response.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_get_response.py @@ -1,16 +1,318 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional -from typing_extensions import TypeAlias +from typing import TYPE_CHECKING, List, Union, Optional +from typing_extensions import Literal, TypeAlias + +from pydantic import Field as FieldInfo from ......_models import BaseModel -from .....workers.binding import Binding -from .....workers.stepped_migration import SteppedMigration +from .....workers.migration_step import MigrationStep from .....workers.single_step_migration import SingleStepMigration -from .....workers.placement_configuration import PlacementConfiguration from .....workers.scripts.consumer_script import ConsumerScript -__all__ = ["SettingGetResponse", "Limits", "Migrations", "Observability"] +__all__ = [ + "SettingGetResponse", + "Binding", + "BindingWorkersBindingKindAny", + "BindingWorkersBindingKindAI", + "BindingWorkersBindingKindAnalyticsEngine", + "BindingWorkersBindingKindAssets", + "BindingWorkersBindingKindBrowserRendering", + "BindingWorkersBindingKindD1", + "BindingWorkersBindingKindDispatchNamespace", + "BindingWorkersBindingKindDispatchNamespaceOutbound", + "BindingWorkersBindingKindDispatchNamespaceOutboundWorker", + "BindingWorkersBindingKindDo", + "BindingWorkersBindingKindHyperdrive", + "BindingWorkersBindingKindJson", + "BindingWorkersBindingKindKVNamespace", + "BindingWorkersBindingKindMTLSCERT", + "BindingWorkersBindingKindPlainText", + "BindingWorkersBindingKindQueue", + "BindingWorkersBindingKindR2", + "BindingWorkersBindingKindSecret", + "BindingWorkersBindingKindService", + "BindingWorkersBindingKindTailConsumer", + "BindingWorkersBindingKindVectorize", + "BindingWorkersBindingKindVersionMetadata", + "Limits", + "Migrations", + "MigrationsWorkersMultipleStepMigrations", + "Observability", + "Placement", +] + + +class BindingWorkersBindingKindAny(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + type: str + """The kind of resource that the binding provides.""" + + if TYPE_CHECKING: + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + + +class BindingWorkersBindingKindAI(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["ai"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindAnalyticsEngine(BaseModel): + dataset: str + """The dataset name to bind to.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["analytics_engine"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindAssets(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["assets"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindBrowserRendering(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["browser_rendering"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindD1(BaseModel): + id: str + """Identifier of the D1 database to bind to.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["d1"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindDispatchNamespaceOutboundWorker(BaseModel): + environment: Optional[str] = None + """Environment of the outbound worker.""" + + service: Optional[str] = None + """Name of the outbound worker.""" + + +class BindingWorkersBindingKindDispatchNamespaceOutbound(BaseModel): + params: Optional[List[str]] = None + """ + Pass information from the Dispatch Worker to the Outbound Worker through the + parameters. + """ + + worker: Optional[BindingWorkersBindingKindDispatchNamespaceOutboundWorker] = None + """Outbound worker.""" + + +class BindingWorkersBindingKindDispatchNamespace(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + namespace: str + """Namespace to bind to.""" + + type: Literal["dispatch_namespace"] + """The kind of resource that the binding provides.""" + + outbound: Optional[BindingWorkersBindingKindDispatchNamespaceOutbound] = None + """Outbound worker.""" + + +class BindingWorkersBindingKindDo(BaseModel): + class_name: str + """The exported class name of the Durable Object.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["durable_object_namespace"] + """The kind of resource that the binding provides.""" + + environment: Optional[str] = None + """The environment of the script_name to bind to.""" + + namespace_id: Optional[str] = None + """Namespace identifier tag.""" + + script_name: Optional[str] = None + """ + The script where the Durable Object is defined, if it is external to this + Worker. + """ + + +class BindingWorkersBindingKindHyperdrive(BaseModel): + id: str + """Identifier of the Hyperdrive connection to bind to.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["hyperdrive"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindJson(BaseModel): + json_: str = FieldInfo(alias="json") + """JSON data to use.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["json"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindKVNamespace(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + namespace_id: str + """Namespace identifier tag.""" + + type: Literal["kv_namespace"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindMTLSCERT(BaseModel): + certificate_id: str + """Identifier of the certificate to bind to.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["mtls_certificate"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindPlainText(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + text: str + """The text value to use.""" + + type: Literal["plain_text"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindQueue(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + queue_name: str + """Name of the Queue to bind to.""" + + type: Literal["queue"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindR2(BaseModel): + bucket_name: str + """R2 bucket to bind to.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["r2_bucket"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindSecret(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + text: str + """The secret value to use.""" + + type: Literal["secret_text"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindService(BaseModel): + environment: str + """Optional environment if the Worker utilizes one.""" + + name: str + """A JavaScript variable name for the binding.""" + + service: str + """Name of Worker to bind to.""" + + type: Literal["service"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindTailConsumer(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + service: str + """Name of Tail Worker to bind to.""" + + type: Literal["tail_consumer"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindVectorize(BaseModel): + index_name: str + """Name of the Vectorize index to bind to.""" + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["vectorize"] + """The kind of resource that the binding provides.""" + + +class BindingWorkersBindingKindVersionMetadata(BaseModel): + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["version_metadata"] + """The kind of resource that the binding provides.""" + + +Binding: TypeAlias = Union[ + BindingWorkersBindingKindAny, + BindingWorkersBindingKindAI, + BindingWorkersBindingKindAnalyticsEngine, + BindingWorkersBindingKindAssets, + BindingWorkersBindingKindBrowserRendering, + BindingWorkersBindingKindD1, + BindingWorkersBindingKindDispatchNamespace, + BindingWorkersBindingKindDo, + BindingWorkersBindingKindHyperdrive, + BindingWorkersBindingKindJson, + BindingWorkersBindingKindKVNamespace, + BindingWorkersBindingKindMTLSCERT, + BindingWorkersBindingKindPlainText, + BindingWorkersBindingKindQueue, + BindingWorkersBindingKindR2, + BindingWorkersBindingKindSecret, + BindingWorkersBindingKindService, + BindingWorkersBindingKindTailConsumer, + BindingWorkersBindingKindVectorize, + BindingWorkersBindingKindVersionMetadata, +] class Limits(BaseModel): @@ -18,7 +320,21 @@ class Limits(BaseModel): """The amount of CPU time this Worker can use in milliseconds.""" -Migrations: TypeAlias = Union[SingleStepMigration, SteppedMigration] +class MigrationsWorkersMultipleStepMigrations(BaseModel): + new_tag: Optional[str] = None + """Tag to set as the latest migration tag.""" + + old_tag: Optional[str] = None + """Tag used to verify against the latest migration tag for this Worker. + + If they don't match, the upload is rejected. + """ + + steps: Optional[List[MigrationStep]] = None + """Migrations to apply in order.""" + + +Migrations: TypeAlias = Union[SingleStepMigration, MigrationsWorkersMultipleStepMigrations] class Observability(BaseModel): @@ -32,15 +348,35 @@ class Observability(BaseModel): """ +class Placement(BaseModel): + mode: Optional[Literal["smart"]] = None + """ + Enables + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ + + class SettingGetResponse(BaseModel): bindings: Optional[List[Binding]] = None - """List of bindings attached to this Worker""" + """List of bindings attached to a Worker. + + You can find more about bindings on our docs: + https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings. + """ compatibility_date: Optional[str] = None - """Opt your Worker into changes after this date""" + """Date indicating targeted support in the Workers runtime. + + Backwards incompatible fixes to the runtime following this date will not affect + this Worker. + """ compatibility_flags: Optional[List[str]] = None - """Opt your Worker into specific changes""" + """Flags that enable or disable certain features in the Workers runtime. + + Used to enable upcoming features or opt in or out of specific changes not + included in a `compatibility_date`. + """ limits: Optional[Limits] = None """Limits to apply for this Worker.""" @@ -54,7 +390,11 @@ class SettingGetResponse(BaseModel): observability: Optional[Observability] = None """Observability settings for the Worker.""" - placement: Optional[PlacementConfiguration] = None + placement: Optional[Placement] = None + """ + Configuration for + [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + """ tags: Optional[List[str]] = None """Tags to help you manage your Workers""" @@ -62,5 +402,5 @@ class SettingGetResponse(BaseModel): tail_consumers: Optional[List[ConsumerScript]] = None """List of Workers that will consume logs from the attached Worker.""" - usage_model: Optional[str] = None - """Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound').""" + usage_model: Optional[Literal["standard"]] = None + """Usage model for the Worker invocations.""" diff --git a/src/cloudflare/types/zero_trust/access/__init__.py b/src/cloudflare/types/zero_trust/access/__init__.py index 042c3929e5c..3db17eae160 100644 --- a/src/cloudflare/types/zero_trust/access/__init__.py +++ b/src/cloudflare/types/zero_trust/access/__init__.py @@ -54,6 +54,7 @@ from .application_get_response import ApplicationGetResponse as ApplicationGetResponse from .bookmark_delete_response import BookmarkDeleteResponse as BookmarkDeleteResponse from .custom_page_without_html import CustomPageWithoutHTML as CustomPageWithoutHTML +from .gateway_ca_list_response import GatewayCAListResponse as GatewayCAListResponse from .application_create_params import ApplicationCreateParams as ApplicationCreateParams from .application_list_response import ApplicationListResponse as ApplicationListResponse from .application_update_params import ApplicationUpdateParams as ApplicationUpdateParams @@ -63,6 +64,8 @@ from .custom_page_update_params import CustomPageUpdateParams as CustomPageUpdateParams from .scim_config_mapping_param import SCIMConfigMappingParam as SCIMConfigMappingParam from .service_token_list_params import ServiceTokenListParams as ServiceTokenListParams +from .gateway_ca_create_response import GatewayCACreateResponse as GatewayCACreateResponse +from .gateway_ca_delete_response import GatewayCADeleteResponse as GatewayCADeleteResponse from .application_create_response import ApplicationCreateResponse as ApplicationCreateResponse from .application_delete_response import ApplicationDeleteResponse as ApplicationDeleteResponse from .application_update_response import ApplicationUpdateResponse as ApplicationUpdateResponse diff --git a/src/cloudflare/types/zero_trust/access/application_create_params.py b/src/cloudflare/types/zero_trust/access/application_create_params.py index 46981914209..8f28b6ec26a 100644 --- a/src/cloudflare/types/zero_trust/access/application_create_params.py +++ b/src/cloudflare/types/zero_trust/access/application_create_params.py @@ -23,11 +23,16 @@ "ApplicationCreateParams", "SelfHostedApplication", "SelfHostedApplicationDestination", + "SelfHostedApplicationDestinationPublicDestination", + "SelfHostedApplicationDestinationPrivateDestination", "SelfHostedApplicationPolicy", "SelfHostedApplicationPolicyAccessAppPolicyLink", "SelfHostedApplicationPolicyUnionMember2", "SelfHostedApplicationSCIMConfig", "SelfHostedApplicationSCIMConfigAuthentication", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "SaaSApplication", "SaaSApplicationPolicy", "SaaSApplicationPolicyAccessAppPolicyLink", @@ -35,20 +40,33 @@ "SaaSApplicationSaaSApp", "SaaSApplicationSCIMConfig", "SaaSApplicationSCIMConfigAuthentication", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BrowserSSHApplication", "BrowserSSHApplicationDestination", + "BrowserSSHApplicationDestinationPublicDestination", + "BrowserSSHApplicationDestinationPrivateDestination", "BrowserSSHApplicationPolicy", "BrowserSSHApplicationPolicyAccessAppPolicyLink", "BrowserSSHApplicationPolicyUnionMember2", "BrowserSSHApplicationSCIMConfig", "BrowserSSHApplicationSCIMConfigAuthentication", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BrowserVNCApplication", "BrowserVNCApplicationDestination", + "BrowserVNCApplicationDestinationPublicDestination", + "BrowserVNCApplicationDestinationPrivateDestination", "BrowserVNCApplicationPolicy", "BrowserVNCApplicationPolicyAccessAppPolicyLink", "BrowserVNCApplicationPolicyUnionMember2", "BrowserVNCApplicationSCIMConfig", "BrowserVNCApplicationSCIMConfigAuthentication", + "BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "AppLauncherApplication", "AppLauncherApplicationFooterLink", "AppLauncherApplicationLandingPageDesign", @@ -57,6 +75,9 @@ "AppLauncherApplicationPolicyUnionMember2", "AppLauncherApplicationSCIMConfig", "AppLauncherApplicationSCIMConfigAuthentication", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "DeviceEnrollmentPermissionsApplication", "DeviceEnrollmentPermissionsApplicationFooterLink", "DeviceEnrollmentPermissionsApplicationLandingPageDesign", @@ -65,6 +86,9 @@ "DeviceEnrollmentPermissionsApplicationPolicyUnionMember2", "DeviceEnrollmentPermissionsApplicationSCIMConfig", "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BrowserIsolationPermissionsApplication", "BrowserIsolationPermissionsApplicationFooterLink", "BrowserIsolationPermissionsApplicationLandingPageDesign", @@ -73,9 +97,15 @@ "BrowserIsolationPermissionsApplicationPolicyUnionMember2", "BrowserIsolationPermissionsApplicationSCIMConfig", "BrowserIsolationPermissionsApplicationSCIMConfigAuthentication", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BookmarkApplication", "BookmarkApplicationSCIMConfig", "BookmarkApplicationSCIMConfigAuthentication", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "InfrastructureApplication", "InfrastructureApplicationTargetCriterion", "InfrastructureApplicationPolicy", @@ -233,20 +263,47 @@ class SelfHostedApplication(TypedDict, total=False): """ -class SelfHostedApplicationDestination(TypedDict, total=False): - type: Literal["public", "private"] +class SelfHostedApplicationDestinationPublicDestination(TypedDict, total=False): + type: Literal["public"] uri: str """The URI of the destination. - Public destinations can include a domain and path with + Public destinations' URIs can include a domain and path with [wildcards](https://developers.cloudflare.com/cloudflare-one/policies/access/app-paths/). - Private destinations are an early access feature and gated behind a feature - flag. Private destinations support private IPv4, IPv6, and Server Name - Indications (SNI) with optional port ranges. """ +class SelfHostedApplicationDestinationPrivateDestination(TypedDict, total=False): + cidr: str + """The CIDR range of the destination. Single IPs will be computed as /32.""" + + hostname: str + """The hostname of the destination. Matches a valid SNI served by an HTTPS origin.""" + + l4_protocol: Literal["tcp", "udp"] + """The L4 protocol of the destination. + + When omitted, both UDP and TCP traffic will match. + """ + + port_range: str + """The port range of the destination. + + Can be a single port or a range of ports. When omitted, all ports will match. + """ + + type: Literal["private"] + + vnet_id: str + """The VNET ID to match the destination. When omitted, all VNETs will match.""" + + +SelfHostedApplicationDestination: TypeAlias = Union[ + SelfHostedApplicationDestinationPublicDestination, SelfHostedApplicationDestinationPrivateDestination +] + + class SelfHostedApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): id: str """The UUID of the policy""" @@ -302,10 +359,58 @@ class SelfHostedApplicationPolicyUnionMember2(TypedDict, total=False): SelfHostedApplicationPolicyAccessAppPolicyLink, str, SelfHostedApplicationPolicyUnionMember2 ] + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasicParam, + SCIMConfigAuthenticationOAuthBearerTokenParam, + SCIMConfigAuthenticationOauth2Param, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + SelfHostedApplicationSCIMConfigAuthentication: TypeAlias = Union[ SCIMConfigAuthenticationHTTPBasicParam, SCIMConfigAuthenticationOAuthBearerTokenParam, SCIMConfigAuthenticationOauth2Param, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + Iterable[SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -457,10 +562,56 @@ class SaaSApplicationPolicyUnionMember2(TypedDict, total=False): SaaSApplicationSaaSApp: TypeAlias = Union[SAMLSaaSAppParam, OIDCSaaSAppParam] + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(TypedDict, total=False): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasicParam, + SCIMConfigAuthenticationOAuthBearerTokenParam, + SCIMConfigAuthenticationOauth2Param, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + SaaSApplicationSCIMConfigAuthentication: TypeAlias = Union[ SCIMConfigAuthenticationHTTPBasicParam, SCIMConfigAuthenticationOAuthBearerTokenParam, SCIMConfigAuthenticationOauth2Param, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + Iterable[SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -646,20 +797,47 @@ class BrowserSSHApplication(TypedDict, total=False): """ -class BrowserSSHApplicationDestination(TypedDict, total=False): - type: Literal["public", "private"] +class BrowserSSHApplicationDestinationPublicDestination(TypedDict, total=False): + type: Literal["public"] uri: str """The URI of the destination. - Public destinations can include a domain and path with + Public destinations' URIs can include a domain and path with [wildcards](https://developers.cloudflare.com/cloudflare-one/policies/access/app-paths/). - Private destinations are an early access feature and gated behind a feature - flag. Private destinations support private IPv4, IPv6, and Server Name - Indications (SNI) with optional port ranges. """ +class BrowserSSHApplicationDestinationPrivateDestination(TypedDict, total=False): + cidr: str + """The CIDR range of the destination. Single IPs will be computed as /32.""" + + hostname: str + """The hostname of the destination. Matches a valid SNI served by an HTTPS origin.""" + + l4_protocol: Literal["tcp", "udp"] + """The L4 protocol of the destination. + + When omitted, both UDP and TCP traffic will match. + """ + + port_range: str + """The port range of the destination. + + Can be a single port or a range of ports. When omitted, all ports will match. + """ + + type: Literal["private"] + + vnet_id: str + """The VNET ID to match the destination. When omitted, all VNETs will match.""" + + +BrowserSSHApplicationDestination: TypeAlias = Union[ + BrowserSSHApplicationDestinationPublicDestination, BrowserSSHApplicationDestinationPrivateDestination +] + + class BrowserSSHApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): id: str """The UUID of the policy""" @@ -715,10 +893,58 @@ class BrowserSSHApplicationPolicyUnionMember2(TypedDict, total=False): BrowserSSHApplicationPolicyAccessAppPolicyLink, str, BrowserSSHApplicationPolicyUnionMember2 ] + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasicParam, + SCIMConfigAuthenticationOAuthBearerTokenParam, + SCIMConfigAuthenticationOauth2Param, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BrowserSSHApplicationSCIMConfigAuthentication: TypeAlias = Union[ SCIMConfigAuthenticationHTTPBasicParam, SCIMConfigAuthenticationOAuthBearerTokenParam, SCIMConfigAuthenticationOauth2Param, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + Iterable[BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -904,20 +1130,47 @@ class BrowserVNCApplication(TypedDict, total=False): """ -class BrowserVNCApplicationDestination(TypedDict, total=False): - type: Literal["public", "private"] +class BrowserVNCApplicationDestinationPublicDestination(TypedDict, total=False): + type: Literal["public"] uri: str """The URI of the destination. - Public destinations can include a domain and path with + Public destinations' URIs can include a domain and path with [wildcards](https://developers.cloudflare.com/cloudflare-one/policies/access/app-paths/). - Private destinations are an early access feature and gated behind a feature - flag. Private destinations support private IPv4, IPv6, and Server Name - Indications (SNI) with optional port ranges. """ +class BrowserVNCApplicationDestinationPrivateDestination(TypedDict, total=False): + cidr: str + """The CIDR range of the destination. Single IPs will be computed as /32.""" + + hostname: str + """The hostname of the destination. Matches a valid SNI served by an HTTPS origin.""" + + l4_protocol: Literal["tcp", "udp"] + """The L4 protocol of the destination. + + When omitted, both UDP and TCP traffic will match. + """ + + port_range: str + """The port range of the destination. + + Can be a single port or a range of ports. When omitted, all ports will match. + """ + + type: Literal["private"] + + vnet_id: str + """The VNET ID to match the destination. When omitted, all VNETs will match.""" + + +BrowserVNCApplicationDestination: TypeAlias = Union[ + BrowserVNCApplicationDestinationPublicDestination, BrowserVNCApplicationDestinationPrivateDestination +] + + class BrowserVNCApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): id: str """The UUID of the policy""" @@ -973,10 +1226,58 @@ class BrowserVNCApplicationPolicyUnionMember2(TypedDict, total=False): BrowserVNCApplicationPolicyAccessAppPolicyLink, str, BrowserVNCApplicationPolicyUnionMember2 ] + +class BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasicParam, + SCIMConfigAuthenticationOAuthBearerTokenParam, + SCIMConfigAuthenticationOauth2Param, + BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BrowserVNCApplicationSCIMConfigAuthentication: TypeAlias = Union[ SCIMConfigAuthenticationHTTPBasicParam, SCIMConfigAuthenticationOAuthBearerTokenParam, SCIMConfigAuthenticationOauth2Param, + BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + Iterable[BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1156,10 +1457,58 @@ class AppLauncherApplicationPolicyUnionMember2(TypedDict, total=False): AppLauncherApplicationPolicyAccessAppPolicyLink, str, AppLauncherApplicationPolicyUnionMember2 ] + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasicParam, + SCIMConfigAuthenticationOAuthBearerTokenParam, + SCIMConfigAuthenticationOauth2Param, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + AppLauncherApplicationSCIMConfigAuthentication: TypeAlias = Union[ SCIMConfigAuthenticationHTTPBasicParam, SCIMConfigAuthenticationOAuthBearerTokenParam, SCIMConfigAuthenticationOauth2Param, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + Iterable[AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1341,10 +1690,58 @@ class DeviceEnrollmentPermissionsApplicationPolicyUnionMember2(TypedDict, total= DeviceEnrollmentPermissionsApplicationPolicyUnionMember2, ] + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasicParam, + SCIMConfigAuthenticationOAuthBearerTokenParam, + SCIMConfigAuthenticationOauth2Param, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication: TypeAlias = Union[ SCIMConfigAuthenticationHTTPBasicParam, SCIMConfigAuthenticationOAuthBearerTokenParam, SCIMConfigAuthenticationOauth2Param, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + Iterable[DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1526,10 +1923,58 @@ class BrowserIsolationPermissionsApplicationPolicyUnionMember2(TypedDict, total= BrowserIsolationPermissionsApplicationPolicyUnionMember2, ] + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasicParam, + SCIMConfigAuthenticationOAuthBearerTokenParam, + SCIMConfigAuthenticationOauth2Param, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BrowserIsolationPermissionsApplicationSCIMConfigAuthentication: TypeAlias = Union[ SCIMConfigAuthenticationHTTPBasicParam, SCIMConfigAuthenticationOAuthBearerTokenParam, SCIMConfigAuthenticationOauth2Param, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + Iterable[BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1601,10 +2046,57 @@ class BookmarkApplication(TypedDict, total=False): """The application type.""" +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasicParam, + SCIMConfigAuthenticationOAuthBearerTokenParam, + SCIMConfigAuthenticationOauth2Param, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BookmarkApplicationSCIMConfigAuthentication: TypeAlias = Union[ SCIMConfigAuthenticationHTTPBasicParam, SCIMConfigAuthenticationOAuthBearerTokenParam, SCIMConfigAuthenticationOauth2Param, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + Iterable[BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] diff --git a/src/cloudflare/types/zero_trust/access/application_create_response.py b/src/cloudflare/types/zero_trust/access/application_create_response.py index 6249dd96de2..1f3a5fdb214 100644 --- a/src/cloudflare/types/zero_trust/access/application_create_response.py +++ b/src/cloudflare/types/zero_trust/access/application_create_response.py @@ -23,45 +23,75 @@ "ApplicationCreateResponse", "SelfHostedApplication", "SelfHostedApplicationDestination", + "SelfHostedApplicationDestinationPublicDestination", + "SelfHostedApplicationDestinationPrivateDestination", "SelfHostedApplicationPolicy", "SelfHostedApplicationSCIMConfig", "SelfHostedApplicationSCIMConfigAuthentication", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "SaaSApplication", "SaaSApplicationPolicy", "SaaSApplicationSaaSApp", "SaaSApplicationSCIMConfig", "SaaSApplicationSCIMConfigAuthentication", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BrowserSSHApplication", "BrowserSSHApplicationDestination", + "BrowserSSHApplicationDestinationPublicDestination", + "BrowserSSHApplicationDestinationPrivateDestination", "BrowserSSHApplicationPolicy", "BrowserSSHApplicationSCIMConfig", "BrowserSSHApplicationSCIMConfigAuthentication", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BrowserVNCApplication", "BrowserVNCApplicationDestination", + "BrowserVNCApplicationDestinationPublicDestination", + "BrowserVNCApplicationDestinationPrivateDestination", "BrowserVNCApplicationPolicy", "BrowserVNCApplicationSCIMConfig", "BrowserVNCApplicationSCIMConfigAuthentication", + "BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "AppLauncherApplication", "AppLauncherApplicationFooterLink", "AppLauncherApplicationLandingPageDesign", "AppLauncherApplicationPolicy", "AppLauncherApplicationSCIMConfig", "AppLauncherApplicationSCIMConfigAuthentication", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "DeviceEnrollmentPermissionsApplication", "DeviceEnrollmentPermissionsApplicationFooterLink", "DeviceEnrollmentPermissionsApplicationLandingPageDesign", "DeviceEnrollmentPermissionsApplicationPolicy", "DeviceEnrollmentPermissionsApplicationSCIMConfig", "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BrowserIsolationPermissionsApplication", "BrowserIsolationPermissionsApplicationFooterLink", "BrowserIsolationPermissionsApplicationLandingPageDesign", "BrowserIsolationPermissionsApplicationPolicy", "BrowserIsolationPermissionsApplicationSCIMConfig", "BrowserIsolationPermissionsApplicationSCIMConfigAuthentication", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BookmarkApplication", "BookmarkApplicationSCIMConfig", "BookmarkApplicationSCIMConfigAuthentication", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "InfrastructureApplication", "InfrastructureApplicationTargetCriterion", "InfrastructureApplicationPolicy", @@ -69,23 +99,53 @@ "InfrastructureApplicationPolicyConnectionRulesSSH", "InfrastructureApplicationSCIMConfig", "InfrastructureApplicationSCIMConfigAuthentication", + "InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", ] -class SelfHostedApplicationDestination(BaseModel): - type: Optional[Literal["public", "private"]] = None +class SelfHostedApplicationDestinationPublicDestination(BaseModel): + type: Optional[Literal["public"]] = None uri: Optional[str] = None """The URI of the destination. - Public destinations can include a domain and path with + Public destinations' URIs can include a domain and path with [wildcards](https://developers.cloudflare.com/cloudflare-one/policies/access/app-paths/). - Private destinations are an early access feature and gated behind a feature - flag. Private destinations support private IPv4, IPv6, and Server Name - Indications (SNI) with optional port ranges. """ +class SelfHostedApplicationDestinationPrivateDestination(BaseModel): + cidr: Optional[str] = None + """The CIDR range of the destination. Single IPs will be computed as /32.""" + + hostname: Optional[str] = None + """The hostname of the destination. Matches a valid SNI served by an HTTPS origin.""" + + l4_protocol: Optional[Literal["tcp", "udp"]] = None + """The L4 protocol of the destination. + + When omitted, both UDP and TCP traffic will match. + """ + + port_range: Optional[str] = None + """The port range of the destination. + + Can be a single port or a range of ports. When omitted, all ports will match. + """ + + type: Optional[Literal["private"]] = None + + vnet_id: Optional[str] = None + """The VNET ID to match the destination. When omitted, all VNETs will match.""" + + +SelfHostedApplicationDestination: TypeAlias = Union[ + SelfHostedApplicationDestinationPublicDestination, SelfHostedApplicationDestinationPrivateDestination +] + + class SelfHostedApplicationPolicy(ApplicationPolicy): precedence: Optional[int] = None """The order of execution for this policy. @@ -94,8 +154,55 @@ class SelfHostedApplicationPolicy(ApplicationPolicy): """ +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + SelfHostedApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -290,8 +397,56 @@ class SaaSApplicationPolicy(ApplicationPolicy): SaaSApplicationSaaSApp: TypeAlias = Union[SAMLSaaSApp, OIDCSaaSApp] + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + SaaSApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -385,20 +540,47 @@ class SaaSApplication(BaseModel): updated_at: Optional[datetime] = None -class BrowserSSHApplicationDestination(BaseModel): - type: Optional[Literal["public", "private"]] = None +class BrowserSSHApplicationDestinationPublicDestination(BaseModel): + type: Optional[Literal["public"]] = None uri: Optional[str] = None """The URI of the destination. - Public destinations can include a domain and path with + Public destinations' URIs can include a domain and path with [wildcards](https://developers.cloudflare.com/cloudflare-one/policies/access/app-paths/). - Private destinations are an early access feature and gated behind a feature - flag. Private destinations support private IPv4, IPv6, and Server Name - Indications (SNI) with optional port ranges. """ +class BrowserSSHApplicationDestinationPrivateDestination(BaseModel): + cidr: Optional[str] = None + """The CIDR range of the destination. Single IPs will be computed as /32.""" + + hostname: Optional[str] = None + """The hostname of the destination. Matches a valid SNI served by an HTTPS origin.""" + + l4_protocol: Optional[Literal["tcp", "udp"]] = None + """The L4 protocol of the destination. + + When omitted, both UDP and TCP traffic will match. + """ + + port_range: Optional[str] = None + """The port range of the destination. + + Can be a single port or a range of ports. When omitted, all ports will match. + """ + + type: Optional[Literal["private"]] = None + + vnet_id: Optional[str] = None + """The VNET ID to match the destination. When omitted, all VNETs will match.""" + + +BrowserSSHApplicationDestination: TypeAlias = Union[ + BrowserSSHApplicationDestinationPublicDestination, BrowserSSHApplicationDestinationPrivateDestination +] + + class BrowserSSHApplicationPolicy(ApplicationPolicy): precedence: Optional[int] = None """The order of execution for this policy. @@ -407,8 +589,55 @@ class BrowserSSHApplicationPolicy(ApplicationPolicy): """ +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BrowserSSHApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -593,20 +822,47 @@ class BrowserSSHApplication(BaseModel): updated_at: Optional[datetime] = None -class BrowserVNCApplicationDestination(BaseModel): - type: Optional[Literal["public", "private"]] = None +class BrowserVNCApplicationDestinationPublicDestination(BaseModel): + type: Optional[Literal["public"]] = None uri: Optional[str] = None """The URI of the destination. - Public destinations can include a domain and path with + Public destinations' URIs can include a domain and path with [wildcards](https://developers.cloudflare.com/cloudflare-one/policies/access/app-paths/). - Private destinations are an early access feature and gated behind a feature - flag. Private destinations support private IPv4, IPv6, and Server Name - Indications (SNI) with optional port ranges. """ +class BrowserVNCApplicationDestinationPrivateDestination(BaseModel): + cidr: Optional[str] = None + """The CIDR range of the destination. Single IPs will be computed as /32.""" + + hostname: Optional[str] = None + """The hostname of the destination. Matches a valid SNI served by an HTTPS origin.""" + + l4_protocol: Optional[Literal["tcp", "udp"]] = None + """The L4 protocol of the destination. + + When omitted, both UDP and TCP traffic will match. + """ + + port_range: Optional[str] = None + """The port range of the destination. + + Can be a single port or a range of ports. When omitted, all ports will match. + """ + + type: Optional[Literal["private"]] = None + + vnet_id: Optional[str] = None + """The VNET ID to match the destination. When omitted, all VNETs will match.""" + + +BrowserVNCApplicationDestination: TypeAlias = Union[ + BrowserVNCApplicationDestinationPublicDestination, BrowserVNCApplicationDestinationPrivateDestination +] + + class BrowserVNCApplicationPolicy(ApplicationPolicy): precedence: Optional[int] = None """The order of execution for this policy. @@ -615,8 +871,55 @@ class BrowserVNCApplicationPolicy(ApplicationPolicy): """ +class BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BrowserVNCApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -834,8 +1137,55 @@ class AppLauncherApplicationPolicy(ApplicationPolicy): """ +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + AppLauncherApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -976,8 +1326,57 @@ class DeviceEnrollmentPermissionsApplicationPolicy(ApplicationPolicy): """ +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1118,8 +1517,57 @@ class BrowserIsolationPermissionsApplicationPolicy(ApplicationPolicy): """ +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BrowserIsolationPermissionsApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1227,8 +1675,55 @@ class BrowserIsolationPermissionsApplication(BaseModel): updated_at: Optional[datetime] = None +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BookmarkApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1376,8 +1871,55 @@ class InfrastructureApplicationPolicy(BaseModel): updated_at: Optional[datetime] = None +class InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + InfrastructureApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] diff --git a/src/cloudflare/types/zero_trust/access/application_get_response.py b/src/cloudflare/types/zero_trust/access/application_get_response.py index 1cd213b07d0..cffacb3a76a 100644 --- a/src/cloudflare/types/zero_trust/access/application_get_response.py +++ b/src/cloudflare/types/zero_trust/access/application_get_response.py @@ -23,45 +23,75 @@ "ApplicationGetResponse", "SelfHostedApplication", "SelfHostedApplicationDestination", + "SelfHostedApplicationDestinationPublicDestination", + "SelfHostedApplicationDestinationPrivateDestination", "SelfHostedApplicationPolicy", "SelfHostedApplicationSCIMConfig", "SelfHostedApplicationSCIMConfigAuthentication", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "SaaSApplication", "SaaSApplicationPolicy", "SaaSApplicationSaaSApp", "SaaSApplicationSCIMConfig", "SaaSApplicationSCIMConfigAuthentication", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BrowserSSHApplication", "BrowserSSHApplicationDestination", + "BrowserSSHApplicationDestinationPublicDestination", + "BrowserSSHApplicationDestinationPrivateDestination", "BrowserSSHApplicationPolicy", "BrowserSSHApplicationSCIMConfig", "BrowserSSHApplicationSCIMConfigAuthentication", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BrowserVNCApplication", "BrowserVNCApplicationDestination", + "BrowserVNCApplicationDestinationPublicDestination", + "BrowserVNCApplicationDestinationPrivateDestination", "BrowserVNCApplicationPolicy", "BrowserVNCApplicationSCIMConfig", "BrowserVNCApplicationSCIMConfigAuthentication", + "BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "AppLauncherApplication", "AppLauncherApplicationFooterLink", "AppLauncherApplicationLandingPageDesign", "AppLauncherApplicationPolicy", "AppLauncherApplicationSCIMConfig", "AppLauncherApplicationSCIMConfigAuthentication", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "DeviceEnrollmentPermissionsApplication", "DeviceEnrollmentPermissionsApplicationFooterLink", "DeviceEnrollmentPermissionsApplicationLandingPageDesign", "DeviceEnrollmentPermissionsApplicationPolicy", "DeviceEnrollmentPermissionsApplicationSCIMConfig", "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BrowserIsolationPermissionsApplication", "BrowserIsolationPermissionsApplicationFooterLink", "BrowserIsolationPermissionsApplicationLandingPageDesign", "BrowserIsolationPermissionsApplicationPolicy", "BrowserIsolationPermissionsApplicationSCIMConfig", "BrowserIsolationPermissionsApplicationSCIMConfigAuthentication", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BookmarkApplication", "BookmarkApplicationSCIMConfig", "BookmarkApplicationSCIMConfigAuthentication", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "InfrastructureApplication", "InfrastructureApplicationTargetCriterion", "InfrastructureApplicationPolicy", @@ -69,23 +99,53 @@ "InfrastructureApplicationPolicyConnectionRulesSSH", "InfrastructureApplicationSCIMConfig", "InfrastructureApplicationSCIMConfigAuthentication", + "InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", ] -class SelfHostedApplicationDestination(BaseModel): - type: Optional[Literal["public", "private"]] = None +class SelfHostedApplicationDestinationPublicDestination(BaseModel): + type: Optional[Literal["public"]] = None uri: Optional[str] = None """The URI of the destination. - Public destinations can include a domain and path with + Public destinations' URIs can include a domain and path with [wildcards](https://developers.cloudflare.com/cloudflare-one/policies/access/app-paths/). - Private destinations are an early access feature and gated behind a feature - flag. Private destinations support private IPv4, IPv6, and Server Name - Indications (SNI) with optional port ranges. """ +class SelfHostedApplicationDestinationPrivateDestination(BaseModel): + cidr: Optional[str] = None + """The CIDR range of the destination. Single IPs will be computed as /32.""" + + hostname: Optional[str] = None + """The hostname of the destination. Matches a valid SNI served by an HTTPS origin.""" + + l4_protocol: Optional[Literal["tcp", "udp"]] = None + """The L4 protocol of the destination. + + When omitted, both UDP and TCP traffic will match. + """ + + port_range: Optional[str] = None + """The port range of the destination. + + Can be a single port or a range of ports. When omitted, all ports will match. + """ + + type: Optional[Literal["private"]] = None + + vnet_id: Optional[str] = None + """The VNET ID to match the destination. When omitted, all VNETs will match.""" + + +SelfHostedApplicationDestination: TypeAlias = Union[ + SelfHostedApplicationDestinationPublicDestination, SelfHostedApplicationDestinationPrivateDestination +] + + class SelfHostedApplicationPolicy(ApplicationPolicy): precedence: Optional[int] = None """The order of execution for this policy. @@ -94,8 +154,55 @@ class SelfHostedApplicationPolicy(ApplicationPolicy): """ +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + SelfHostedApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -290,8 +397,56 @@ class SaaSApplicationPolicy(ApplicationPolicy): SaaSApplicationSaaSApp: TypeAlias = Union[SAMLSaaSApp, OIDCSaaSApp] + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + SaaSApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -385,20 +540,47 @@ class SaaSApplication(BaseModel): updated_at: Optional[datetime] = None -class BrowserSSHApplicationDestination(BaseModel): - type: Optional[Literal["public", "private"]] = None +class BrowserSSHApplicationDestinationPublicDestination(BaseModel): + type: Optional[Literal["public"]] = None uri: Optional[str] = None """The URI of the destination. - Public destinations can include a domain and path with + Public destinations' URIs can include a domain and path with [wildcards](https://developers.cloudflare.com/cloudflare-one/policies/access/app-paths/). - Private destinations are an early access feature and gated behind a feature - flag. Private destinations support private IPv4, IPv6, and Server Name - Indications (SNI) with optional port ranges. """ +class BrowserSSHApplicationDestinationPrivateDestination(BaseModel): + cidr: Optional[str] = None + """The CIDR range of the destination. Single IPs will be computed as /32.""" + + hostname: Optional[str] = None + """The hostname of the destination. Matches a valid SNI served by an HTTPS origin.""" + + l4_protocol: Optional[Literal["tcp", "udp"]] = None + """The L4 protocol of the destination. + + When omitted, both UDP and TCP traffic will match. + """ + + port_range: Optional[str] = None + """The port range of the destination. + + Can be a single port or a range of ports. When omitted, all ports will match. + """ + + type: Optional[Literal["private"]] = None + + vnet_id: Optional[str] = None + """The VNET ID to match the destination. When omitted, all VNETs will match.""" + + +BrowserSSHApplicationDestination: TypeAlias = Union[ + BrowserSSHApplicationDestinationPublicDestination, BrowserSSHApplicationDestinationPrivateDestination +] + + class BrowserSSHApplicationPolicy(ApplicationPolicy): precedence: Optional[int] = None """The order of execution for this policy. @@ -407,8 +589,55 @@ class BrowserSSHApplicationPolicy(ApplicationPolicy): """ +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BrowserSSHApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -593,20 +822,47 @@ class BrowserSSHApplication(BaseModel): updated_at: Optional[datetime] = None -class BrowserVNCApplicationDestination(BaseModel): - type: Optional[Literal["public", "private"]] = None +class BrowserVNCApplicationDestinationPublicDestination(BaseModel): + type: Optional[Literal["public"]] = None uri: Optional[str] = None """The URI of the destination. - Public destinations can include a domain and path with + Public destinations' URIs can include a domain and path with [wildcards](https://developers.cloudflare.com/cloudflare-one/policies/access/app-paths/). - Private destinations are an early access feature and gated behind a feature - flag. Private destinations support private IPv4, IPv6, and Server Name - Indications (SNI) with optional port ranges. """ +class BrowserVNCApplicationDestinationPrivateDestination(BaseModel): + cidr: Optional[str] = None + """The CIDR range of the destination. Single IPs will be computed as /32.""" + + hostname: Optional[str] = None + """The hostname of the destination. Matches a valid SNI served by an HTTPS origin.""" + + l4_protocol: Optional[Literal["tcp", "udp"]] = None + """The L4 protocol of the destination. + + When omitted, both UDP and TCP traffic will match. + """ + + port_range: Optional[str] = None + """The port range of the destination. + + Can be a single port or a range of ports. When omitted, all ports will match. + """ + + type: Optional[Literal["private"]] = None + + vnet_id: Optional[str] = None + """The VNET ID to match the destination. When omitted, all VNETs will match.""" + + +BrowserVNCApplicationDestination: TypeAlias = Union[ + BrowserVNCApplicationDestinationPublicDestination, BrowserVNCApplicationDestinationPrivateDestination +] + + class BrowserVNCApplicationPolicy(ApplicationPolicy): precedence: Optional[int] = None """The order of execution for this policy. @@ -615,8 +871,55 @@ class BrowserVNCApplicationPolicy(ApplicationPolicy): """ +class BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BrowserVNCApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -834,8 +1137,55 @@ class AppLauncherApplicationPolicy(ApplicationPolicy): """ +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + AppLauncherApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -976,8 +1326,57 @@ class DeviceEnrollmentPermissionsApplicationPolicy(ApplicationPolicy): """ +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1118,8 +1517,57 @@ class BrowserIsolationPermissionsApplicationPolicy(ApplicationPolicy): """ +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BrowserIsolationPermissionsApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1227,8 +1675,55 @@ class BrowserIsolationPermissionsApplication(BaseModel): updated_at: Optional[datetime] = None +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BookmarkApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1376,8 +1871,55 @@ class InfrastructureApplicationPolicy(BaseModel): updated_at: Optional[datetime] = None +class InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + InfrastructureApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] diff --git a/src/cloudflare/types/zero_trust/access/application_list_response.py b/src/cloudflare/types/zero_trust/access/application_list_response.py index 975532467ec..1a0257ad43c 100644 --- a/src/cloudflare/types/zero_trust/access/application_list_response.py +++ b/src/cloudflare/types/zero_trust/access/application_list_response.py @@ -23,45 +23,75 @@ "ApplicationListResponse", "SelfHostedApplication", "SelfHostedApplicationDestination", + "SelfHostedApplicationDestinationPublicDestination", + "SelfHostedApplicationDestinationPrivateDestination", "SelfHostedApplicationPolicy", "SelfHostedApplicationSCIMConfig", "SelfHostedApplicationSCIMConfigAuthentication", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "SaaSApplication", "SaaSApplicationPolicy", "SaaSApplicationSaaSApp", "SaaSApplicationSCIMConfig", "SaaSApplicationSCIMConfigAuthentication", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BrowserSSHApplication", "BrowserSSHApplicationDestination", + "BrowserSSHApplicationDestinationPublicDestination", + "BrowserSSHApplicationDestinationPrivateDestination", "BrowserSSHApplicationPolicy", "BrowserSSHApplicationSCIMConfig", "BrowserSSHApplicationSCIMConfigAuthentication", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BrowserVNCApplication", "BrowserVNCApplicationDestination", + "BrowserVNCApplicationDestinationPublicDestination", + "BrowserVNCApplicationDestinationPrivateDestination", "BrowserVNCApplicationPolicy", "BrowserVNCApplicationSCIMConfig", "BrowserVNCApplicationSCIMConfigAuthentication", + "BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "AppLauncherApplication", "AppLauncherApplicationFooterLink", "AppLauncherApplicationLandingPageDesign", "AppLauncherApplicationPolicy", "AppLauncherApplicationSCIMConfig", "AppLauncherApplicationSCIMConfigAuthentication", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "DeviceEnrollmentPermissionsApplication", "DeviceEnrollmentPermissionsApplicationFooterLink", "DeviceEnrollmentPermissionsApplicationLandingPageDesign", "DeviceEnrollmentPermissionsApplicationPolicy", "DeviceEnrollmentPermissionsApplicationSCIMConfig", "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BrowserIsolationPermissionsApplication", "BrowserIsolationPermissionsApplicationFooterLink", "BrowserIsolationPermissionsApplicationLandingPageDesign", "BrowserIsolationPermissionsApplicationPolicy", "BrowserIsolationPermissionsApplicationSCIMConfig", "BrowserIsolationPermissionsApplicationSCIMConfigAuthentication", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BookmarkApplication", "BookmarkApplicationSCIMConfig", "BookmarkApplicationSCIMConfigAuthentication", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "InfrastructureApplication", "InfrastructureApplicationTargetCriterion", "InfrastructureApplicationPolicy", @@ -69,23 +99,53 @@ "InfrastructureApplicationPolicyConnectionRulesSSH", "InfrastructureApplicationSCIMConfig", "InfrastructureApplicationSCIMConfigAuthentication", + "InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", ] -class SelfHostedApplicationDestination(BaseModel): - type: Optional[Literal["public", "private"]] = None +class SelfHostedApplicationDestinationPublicDestination(BaseModel): + type: Optional[Literal["public"]] = None uri: Optional[str] = None """The URI of the destination. - Public destinations can include a domain and path with + Public destinations' URIs can include a domain and path with [wildcards](https://developers.cloudflare.com/cloudflare-one/policies/access/app-paths/). - Private destinations are an early access feature and gated behind a feature - flag. Private destinations support private IPv4, IPv6, and Server Name - Indications (SNI) with optional port ranges. """ +class SelfHostedApplicationDestinationPrivateDestination(BaseModel): + cidr: Optional[str] = None + """The CIDR range of the destination. Single IPs will be computed as /32.""" + + hostname: Optional[str] = None + """The hostname of the destination. Matches a valid SNI served by an HTTPS origin.""" + + l4_protocol: Optional[Literal["tcp", "udp"]] = None + """The L4 protocol of the destination. + + When omitted, both UDP and TCP traffic will match. + """ + + port_range: Optional[str] = None + """The port range of the destination. + + Can be a single port or a range of ports. When omitted, all ports will match. + """ + + type: Optional[Literal["private"]] = None + + vnet_id: Optional[str] = None + """The VNET ID to match the destination. When omitted, all VNETs will match.""" + + +SelfHostedApplicationDestination: TypeAlias = Union[ + SelfHostedApplicationDestinationPublicDestination, SelfHostedApplicationDestinationPrivateDestination +] + + class SelfHostedApplicationPolicy(ApplicationPolicy): precedence: Optional[int] = None """The order of execution for this policy. @@ -94,8 +154,55 @@ class SelfHostedApplicationPolicy(ApplicationPolicy): """ +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + SelfHostedApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -290,8 +397,56 @@ class SaaSApplicationPolicy(ApplicationPolicy): SaaSApplicationSaaSApp: TypeAlias = Union[SAMLSaaSApp, OIDCSaaSApp] + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + SaaSApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -385,20 +540,47 @@ class SaaSApplication(BaseModel): updated_at: Optional[datetime] = None -class BrowserSSHApplicationDestination(BaseModel): - type: Optional[Literal["public", "private"]] = None +class BrowserSSHApplicationDestinationPublicDestination(BaseModel): + type: Optional[Literal["public"]] = None uri: Optional[str] = None """The URI of the destination. - Public destinations can include a domain and path with + Public destinations' URIs can include a domain and path with [wildcards](https://developers.cloudflare.com/cloudflare-one/policies/access/app-paths/). - Private destinations are an early access feature and gated behind a feature - flag. Private destinations support private IPv4, IPv6, and Server Name - Indications (SNI) with optional port ranges. """ +class BrowserSSHApplicationDestinationPrivateDestination(BaseModel): + cidr: Optional[str] = None + """The CIDR range of the destination. Single IPs will be computed as /32.""" + + hostname: Optional[str] = None + """The hostname of the destination. Matches a valid SNI served by an HTTPS origin.""" + + l4_protocol: Optional[Literal["tcp", "udp"]] = None + """The L4 protocol of the destination. + + When omitted, both UDP and TCP traffic will match. + """ + + port_range: Optional[str] = None + """The port range of the destination. + + Can be a single port or a range of ports. When omitted, all ports will match. + """ + + type: Optional[Literal["private"]] = None + + vnet_id: Optional[str] = None + """The VNET ID to match the destination. When omitted, all VNETs will match.""" + + +BrowserSSHApplicationDestination: TypeAlias = Union[ + BrowserSSHApplicationDestinationPublicDestination, BrowserSSHApplicationDestinationPrivateDestination +] + + class BrowserSSHApplicationPolicy(ApplicationPolicy): precedence: Optional[int] = None """The order of execution for this policy. @@ -407,8 +589,55 @@ class BrowserSSHApplicationPolicy(ApplicationPolicy): """ +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BrowserSSHApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -593,20 +822,47 @@ class BrowserSSHApplication(BaseModel): updated_at: Optional[datetime] = None -class BrowserVNCApplicationDestination(BaseModel): - type: Optional[Literal["public", "private"]] = None +class BrowserVNCApplicationDestinationPublicDestination(BaseModel): + type: Optional[Literal["public"]] = None uri: Optional[str] = None """The URI of the destination. - Public destinations can include a domain and path with + Public destinations' URIs can include a domain and path with [wildcards](https://developers.cloudflare.com/cloudflare-one/policies/access/app-paths/). - Private destinations are an early access feature and gated behind a feature - flag. Private destinations support private IPv4, IPv6, and Server Name - Indications (SNI) with optional port ranges. """ +class BrowserVNCApplicationDestinationPrivateDestination(BaseModel): + cidr: Optional[str] = None + """The CIDR range of the destination. Single IPs will be computed as /32.""" + + hostname: Optional[str] = None + """The hostname of the destination. Matches a valid SNI served by an HTTPS origin.""" + + l4_protocol: Optional[Literal["tcp", "udp"]] = None + """The L4 protocol of the destination. + + When omitted, both UDP and TCP traffic will match. + """ + + port_range: Optional[str] = None + """The port range of the destination. + + Can be a single port or a range of ports. When omitted, all ports will match. + """ + + type: Optional[Literal["private"]] = None + + vnet_id: Optional[str] = None + """The VNET ID to match the destination. When omitted, all VNETs will match.""" + + +BrowserVNCApplicationDestination: TypeAlias = Union[ + BrowserVNCApplicationDestinationPublicDestination, BrowserVNCApplicationDestinationPrivateDestination +] + + class BrowserVNCApplicationPolicy(ApplicationPolicy): precedence: Optional[int] = None """The order of execution for this policy. @@ -615,8 +871,55 @@ class BrowserVNCApplicationPolicy(ApplicationPolicy): """ +class BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BrowserVNCApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -834,8 +1137,55 @@ class AppLauncherApplicationPolicy(ApplicationPolicy): """ +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + AppLauncherApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -976,8 +1326,57 @@ class DeviceEnrollmentPermissionsApplicationPolicy(ApplicationPolicy): """ +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1118,8 +1517,57 @@ class BrowserIsolationPermissionsApplicationPolicy(ApplicationPolicy): """ +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BrowserIsolationPermissionsApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1227,8 +1675,55 @@ class BrowserIsolationPermissionsApplication(BaseModel): updated_at: Optional[datetime] = None +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BookmarkApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1376,8 +1871,55 @@ class InfrastructureApplicationPolicy(BaseModel): updated_at: Optional[datetime] = None +class InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + InfrastructureApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] diff --git a/src/cloudflare/types/zero_trust/access/application_update_params.py b/src/cloudflare/types/zero_trust/access/application_update_params.py index 2a8f59a7281..f96f295a24f 100644 --- a/src/cloudflare/types/zero_trust/access/application_update_params.py +++ b/src/cloudflare/types/zero_trust/access/application_update_params.py @@ -23,11 +23,16 @@ "ApplicationUpdateParams", "SelfHostedApplication", "SelfHostedApplicationDestination", + "SelfHostedApplicationDestinationPublicDestination", + "SelfHostedApplicationDestinationPrivateDestination", "SelfHostedApplicationPolicy", "SelfHostedApplicationPolicyAccessAppPolicyLink", "SelfHostedApplicationPolicyUnionMember2", "SelfHostedApplicationSCIMConfig", "SelfHostedApplicationSCIMConfigAuthentication", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "SaaSApplication", "SaaSApplicationPolicy", "SaaSApplicationPolicyAccessAppPolicyLink", @@ -35,20 +40,33 @@ "SaaSApplicationSaaSApp", "SaaSApplicationSCIMConfig", "SaaSApplicationSCIMConfigAuthentication", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BrowserSSHApplication", "BrowserSSHApplicationDestination", + "BrowserSSHApplicationDestinationPublicDestination", + "BrowserSSHApplicationDestinationPrivateDestination", "BrowserSSHApplicationPolicy", "BrowserSSHApplicationPolicyAccessAppPolicyLink", "BrowserSSHApplicationPolicyUnionMember2", "BrowserSSHApplicationSCIMConfig", "BrowserSSHApplicationSCIMConfigAuthentication", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BrowserVNCApplication", "BrowserVNCApplicationDestination", + "BrowserVNCApplicationDestinationPublicDestination", + "BrowserVNCApplicationDestinationPrivateDestination", "BrowserVNCApplicationPolicy", "BrowserVNCApplicationPolicyAccessAppPolicyLink", "BrowserVNCApplicationPolicyUnionMember2", "BrowserVNCApplicationSCIMConfig", "BrowserVNCApplicationSCIMConfigAuthentication", + "BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "AppLauncherApplication", "AppLauncherApplicationFooterLink", "AppLauncherApplicationLandingPageDesign", @@ -57,6 +75,9 @@ "AppLauncherApplicationPolicyUnionMember2", "AppLauncherApplicationSCIMConfig", "AppLauncherApplicationSCIMConfigAuthentication", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "DeviceEnrollmentPermissionsApplication", "DeviceEnrollmentPermissionsApplicationFooterLink", "DeviceEnrollmentPermissionsApplicationLandingPageDesign", @@ -65,6 +86,9 @@ "DeviceEnrollmentPermissionsApplicationPolicyUnionMember2", "DeviceEnrollmentPermissionsApplicationSCIMConfig", "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BrowserIsolationPermissionsApplication", "BrowserIsolationPermissionsApplicationFooterLink", "BrowserIsolationPermissionsApplicationLandingPageDesign", @@ -73,9 +97,15 @@ "BrowserIsolationPermissionsApplicationPolicyUnionMember2", "BrowserIsolationPermissionsApplicationSCIMConfig", "BrowserIsolationPermissionsApplicationSCIMConfigAuthentication", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BookmarkApplication", "BookmarkApplicationSCIMConfig", "BookmarkApplicationSCIMConfigAuthentication", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "InfrastructureApplication", "InfrastructureApplicationTargetCriterion", "InfrastructureApplicationPolicy", @@ -233,20 +263,47 @@ class SelfHostedApplication(TypedDict, total=False): """ -class SelfHostedApplicationDestination(TypedDict, total=False): - type: Literal["public", "private"] +class SelfHostedApplicationDestinationPublicDestination(TypedDict, total=False): + type: Literal["public"] uri: str """The URI of the destination. - Public destinations can include a domain and path with + Public destinations' URIs can include a domain and path with [wildcards](https://developers.cloudflare.com/cloudflare-one/policies/access/app-paths/). - Private destinations are an early access feature and gated behind a feature - flag. Private destinations support private IPv4, IPv6, and Server Name - Indications (SNI) with optional port ranges. """ +class SelfHostedApplicationDestinationPrivateDestination(TypedDict, total=False): + cidr: str + """The CIDR range of the destination. Single IPs will be computed as /32.""" + + hostname: str + """The hostname of the destination. Matches a valid SNI served by an HTTPS origin.""" + + l4_protocol: Literal["tcp", "udp"] + """The L4 protocol of the destination. + + When omitted, both UDP and TCP traffic will match. + """ + + port_range: str + """The port range of the destination. + + Can be a single port or a range of ports. When omitted, all ports will match. + """ + + type: Literal["private"] + + vnet_id: str + """The VNET ID to match the destination. When omitted, all VNETs will match.""" + + +SelfHostedApplicationDestination: TypeAlias = Union[ + SelfHostedApplicationDestinationPublicDestination, SelfHostedApplicationDestinationPrivateDestination +] + + class SelfHostedApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): id: str """The UUID of the policy""" @@ -302,10 +359,58 @@ class SelfHostedApplicationPolicyUnionMember2(TypedDict, total=False): SelfHostedApplicationPolicyAccessAppPolicyLink, str, SelfHostedApplicationPolicyUnionMember2 ] + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasicParam, + SCIMConfigAuthenticationOAuthBearerTokenParam, + SCIMConfigAuthenticationOauth2Param, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + SelfHostedApplicationSCIMConfigAuthentication: TypeAlias = Union[ SCIMConfigAuthenticationHTTPBasicParam, SCIMConfigAuthenticationOAuthBearerTokenParam, SCIMConfigAuthenticationOauth2Param, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + Iterable[SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -457,10 +562,56 @@ class SaaSApplicationPolicyUnionMember2(TypedDict, total=False): SaaSApplicationSaaSApp: TypeAlias = Union[SAMLSaaSAppParam, OIDCSaaSAppParam] + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(TypedDict, total=False): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasicParam, + SCIMConfigAuthenticationOAuthBearerTokenParam, + SCIMConfigAuthenticationOauth2Param, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + SaaSApplicationSCIMConfigAuthentication: TypeAlias = Union[ SCIMConfigAuthenticationHTTPBasicParam, SCIMConfigAuthenticationOAuthBearerTokenParam, SCIMConfigAuthenticationOauth2Param, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + Iterable[SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -646,20 +797,47 @@ class BrowserSSHApplication(TypedDict, total=False): """ -class BrowserSSHApplicationDestination(TypedDict, total=False): - type: Literal["public", "private"] +class BrowserSSHApplicationDestinationPublicDestination(TypedDict, total=False): + type: Literal["public"] uri: str """The URI of the destination. - Public destinations can include a domain and path with + Public destinations' URIs can include a domain and path with [wildcards](https://developers.cloudflare.com/cloudflare-one/policies/access/app-paths/). - Private destinations are an early access feature and gated behind a feature - flag. Private destinations support private IPv4, IPv6, and Server Name - Indications (SNI) with optional port ranges. """ +class BrowserSSHApplicationDestinationPrivateDestination(TypedDict, total=False): + cidr: str + """The CIDR range of the destination. Single IPs will be computed as /32.""" + + hostname: str + """The hostname of the destination. Matches a valid SNI served by an HTTPS origin.""" + + l4_protocol: Literal["tcp", "udp"] + """The L4 protocol of the destination. + + When omitted, both UDP and TCP traffic will match. + """ + + port_range: str + """The port range of the destination. + + Can be a single port or a range of ports. When omitted, all ports will match. + """ + + type: Literal["private"] + + vnet_id: str + """The VNET ID to match the destination. When omitted, all VNETs will match.""" + + +BrowserSSHApplicationDestination: TypeAlias = Union[ + BrowserSSHApplicationDestinationPublicDestination, BrowserSSHApplicationDestinationPrivateDestination +] + + class BrowserSSHApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): id: str """The UUID of the policy""" @@ -715,10 +893,58 @@ class BrowserSSHApplicationPolicyUnionMember2(TypedDict, total=False): BrowserSSHApplicationPolicyAccessAppPolicyLink, str, BrowserSSHApplicationPolicyUnionMember2 ] + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasicParam, + SCIMConfigAuthenticationOAuthBearerTokenParam, + SCIMConfigAuthenticationOauth2Param, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BrowserSSHApplicationSCIMConfigAuthentication: TypeAlias = Union[ SCIMConfigAuthenticationHTTPBasicParam, SCIMConfigAuthenticationOAuthBearerTokenParam, SCIMConfigAuthenticationOauth2Param, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + Iterable[BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -904,20 +1130,47 @@ class BrowserVNCApplication(TypedDict, total=False): """ -class BrowserVNCApplicationDestination(TypedDict, total=False): - type: Literal["public", "private"] +class BrowserVNCApplicationDestinationPublicDestination(TypedDict, total=False): + type: Literal["public"] uri: str """The URI of the destination. - Public destinations can include a domain and path with + Public destinations' URIs can include a domain and path with [wildcards](https://developers.cloudflare.com/cloudflare-one/policies/access/app-paths/). - Private destinations are an early access feature and gated behind a feature - flag. Private destinations support private IPv4, IPv6, and Server Name - Indications (SNI) with optional port ranges. """ +class BrowserVNCApplicationDestinationPrivateDestination(TypedDict, total=False): + cidr: str + """The CIDR range of the destination. Single IPs will be computed as /32.""" + + hostname: str + """The hostname of the destination. Matches a valid SNI served by an HTTPS origin.""" + + l4_protocol: Literal["tcp", "udp"] + """The L4 protocol of the destination. + + When omitted, both UDP and TCP traffic will match. + """ + + port_range: str + """The port range of the destination. + + Can be a single port or a range of ports. When omitted, all ports will match. + """ + + type: Literal["private"] + + vnet_id: str + """The VNET ID to match the destination. When omitted, all VNETs will match.""" + + +BrowserVNCApplicationDestination: TypeAlias = Union[ + BrowserVNCApplicationDestinationPublicDestination, BrowserVNCApplicationDestinationPrivateDestination +] + + class BrowserVNCApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): id: str """The UUID of the policy""" @@ -973,10 +1226,58 @@ class BrowserVNCApplicationPolicyUnionMember2(TypedDict, total=False): BrowserVNCApplicationPolicyAccessAppPolicyLink, str, BrowserVNCApplicationPolicyUnionMember2 ] + +class BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasicParam, + SCIMConfigAuthenticationOAuthBearerTokenParam, + SCIMConfigAuthenticationOauth2Param, + BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BrowserVNCApplicationSCIMConfigAuthentication: TypeAlias = Union[ SCIMConfigAuthenticationHTTPBasicParam, SCIMConfigAuthenticationOAuthBearerTokenParam, SCIMConfigAuthenticationOauth2Param, + BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + Iterable[BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1156,10 +1457,58 @@ class AppLauncherApplicationPolicyUnionMember2(TypedDict, total=False): AppLauncherApplicationPolicyAccessAppPolicyLink, str, AppLauncherApplicationPolicyUnionMember2 ] + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasicParam, + SCIMConfigAuthenticationOAuthBearerTokenParam, + SCIMConfigAuthenticationOauth2Param, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + AppLauncherApplicationSCIMConfigAuthentication: TypeAlias = Union[ SCIMConfigAuthenticationHTTPBasicParam, SCIMConfigAuthenticationOAuthBearerTokenParam, SCIMConfigAuthenticationOauth2Param, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + Iterable[AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1341,10 +1690,58 @@ class DeviceEnrollmentPermissionsApplicationPolicyUnionMember2(TypedDict, total= DeviceEnrollmentPermissionsApplicationPolicyUnionMember2, ] + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasicParam, + SCIMConfigAuthenticationOAuthBearerTokenParam, + SCIMConfigAuthenticationOauth2Param, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication: TypeAlias = Union[ SCIMConfigAuthenticationHTTPBasicParam, SCIMConfigAuthenticationOAuthBearerTokenParam, SCIMConfigAuthenticationOauth2Param, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + Iterable[DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1526,10 +1923,58 @@ class BrowserIsolationPermissionsApplicationPolicyUnionMember2(TypedDict, total= BrowserIsolationPermissionsApplicationPolicyUnionMember2, ] + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasicParam, + SCIMConfigAuthenticationOAuthBearerTokenParam, + SCIMConfigAuthenticationOauth2Param, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BrowserIsolationPermissionsApplicationSCIMConfigAuthentication: TypeAlias = Union[ SCIMConfigAuthenticationHTTPBasicParam, SCIMConfigAuthenticationOAuthBearerTokenParam, SCIMConfigAuthenticationOauth2Param, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + Iterable[BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1601,10 +2046,57 @@ class BookmarkApplication(TypedDict, total=False): """The application type.""" +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + TypedDict, total=False +): + client_id: Required[str] + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: Required[str] + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Required[Literal["access_service_token"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasicParam, + SCIMConfigAuthenticationOAuthBearerTokenParam, + SCIMConfigAuthenticationOauth2Param, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BookmarkApplicationSCIMConfigAuthentication: TypeAlias = Union[ SCIMConfigAuthenticationHTTPBasicParam, SCIMConfigAuthenticationOAuthBearerTokenParam, SCIMConfigAuthenticationOauth2Param, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + Iterable[BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] diff --git a/src/cloudflare/types/zero_trust/access/application_update_response.py b/src/cloudflare/types/zero_trust/access/application_update_response.py index 72369b46d05..00ea299d5f3 100644 --- a/src/cloudflare/types/zero_trust/access/application_update_response.py +++ b/src/cloudflare/types/zero_trust/access/application_update_response.py @@ -23,45 +23,75 @@ "ApplicationUpdateResponse", "SelfHostedApplication", "SelfHostedApplicationDestination", + "SelfHostedApplicationDestinationPublicDestination", + "SelfHostedApplicationDestinationPrivateDestination", "SelfHostedApplicationPolicy", "SelfHostedApplicationSCIMConfig", "SelfHostedApplicationSCIMConfigAuthentication", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "SaaSApplication", "SaaSApplicationPolicy", "SaaSApplicationSaaSApp", "SaaSApplicationSCIMConfig", "SaaSApplicationSCIMConfigAuthentication", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BrowserSSHApplication", "BrowserSSHApplicationDestination", + "BrowserSSHApplicationDestinationPublicDestination", + "BrowserSSHApplicationDestinationPrivateDestination", "BrowserSSHApplicationPolicy", "BrowserSSHApplicationSCIMConfig", "BrowserSSHApplicationSCIMConfigAuthentication", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BrowserVNCApplication", "BrowserVNCApplicationDestination", + "BrowserVNCApplicationDestinationPublicDestination", + "BrowserVNCApplicationDestinationPrivateDestination", "BrowserVNCApplicationPolicy", "BrowserVNCApplicationSCIMConfig", "BrowserVNCApplicationSCIMConfigAuthentication", + "BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "AppLauncherApplication", "AppLauncherApplicationFooterLink", "AppLauncherApplicationLandingPageDesign", "AppLauncherApplicationPolicy", "AppLauncherApplicationSCIMConfig", "AppLauncherApplicationSCIMConfigAuthentication", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "DeviceEnrollmentPermissionsApplication", "DeviceEnrollmentPermissionsApplicationFooterLink", "DeviceEnrollmentPermissionsApplicationLandingPageDesign", "DeviceEnrollmentPermissionsApplicationPolicy", "DeviceEnrollmentPermissionsApplicationSCIMConfig", "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BrowserIsolationPermissionsApplication", "BrowserIsolationPermissionsApplicationFooterLink", "BrowserIsolationPermissionsApplicationLandingPageDesign", "BrowserIsolationPermissionsApplicationPolicy", "BrowserIsolationPermissionsApplicationSCIMConfig", "BrowserIsolationPermissionsApplicationSCIMConfigAuthentication", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "BookmarkApplication", "BookmarkApplicationSCIMConfig", "BookmarkApplicationSCIMConfigAuthentication", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", "InfrastructureApplication", "InfrastructureApplicationTargetCriterion", "InfrastructureApplicationPolicy", @@ -69,23 +99,53 @@ "InfrastructureApplicationPolicyConnectionRulesSSH", "InfrastructureApplicationSCIMConfig", "InfrastructureApplicationSCIMConfigAuthentication", + "InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", + "InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication", + "InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken", ] -class SelfHostedApplicationDestination(BaseModel): - type: Optional[Literal["public", "private"]] = None +class SelfHostedApplicationDestinationPublicDestination(BaseModel): + type: Optional[Literal["public"]] = None uri: Optional[str] = None """The URI of the destination. - Public destinations can include a domain and path with + Public destinations' URIs can include a domain and path with [wildcards](https://developers.cloudflare.com/cloudflare-one/policies/access/app-paths/). - Private destinations are an early access feature and gated behind a feature - flag. Private destinations support private IPv4, IPv6, and Server Name - Indications (SNI) with optional port ranges. """ +class SelfHostedApplicationDestinationPrivateDestination(BaseModel): + cidr: Optional[str] = None + """The CIDR range of the destination. Single IPs will be computed as /32.""" + + hostname: Optional[str] = None + """The hostname of the destination. Matches a valid SNI served by an HTTPS origin.""" + + l4_protocol: Optional[Literal["tcp", "udp"]] = None + """The L4 protocol of the destination. + + When omitted, both UDP and TCP traffic will match. + """ + + port_range: Optional[str] = None + """The port range of the destination. + + Can be a single port or a range of ports. When omitted, all ports will match. + """ + + type: Optional[Literal["private"]] = None + + vnet_id: Optional[str] = None + """The VNET ID to match the destination. When omitted, all VNETs will match.""" + + +SelfHostedApplicationDestination: TypeAlias = Union[ + SelfHostedApplicationDestinationPublicDestination, SelfHostedApplicationDestinationPrivateDestination +] + + class SelfHostedApplicationPolicy(ApplicationPolicy): precedence: Optional[int] = None """The order of execution for this policy. @@ -94,8 +154,55 @@ class SelfHostedApplicationPolicy(ApplicationPolicy): """ +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + SelfHostedApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -290,8 +397,56 @@ class SaaSApplicationPolicy(ApplicationPolicy): SaaSApplicationSaaSApp: TypeAlias = Union[SAMLSaaSApp, OIDCSaaSApp] + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + SaaSApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -385,20 +540,47 @@ class SaaSApplication(BaseModel): updated_at: Optional[datetime] = None -class BrowserSSHApplicationDestination(BaseModel): - type: Optional[Literal["public", "private"]] = None +class BrowserSSHApplicationDestinationPublicDestination(BaseModel): + type: Optional[Literal["public"]] = None uri: Optional[str] = None """The URI of the destination. - Public destinations can include a domain and path with + Public destinations' URIs can include a domain and path with [wildcards](https://developers.cloudflare.com/cloudflare-one/policies/access/app-paths/). - Private destinations are an early access feature and gated behind a feature - flag. Private destinations support private IPv4, IPv6, and Server Name - Indications (SNI) with optional port ranges. """ +class BrowserSSHApplicationDestinationPrivateDestination(BaseModel): + cidr: Optional[str] = None + """The CIDR range of the destination. Single IPs will be computed as /32.""" + + hostname: Optional[str] = None + """The hostname of the destination. Matches a valid SNI served by an HTTPS origin.""" + + l4_protocol: Optional[Literal["tcp", "udp"]] = None + """The L4 protocol of the destination. + + When omitted, both UDP and TCP traffic will match. + """ + + port_range: Optional[str] = None + """The port range of the destination. + + Can be a single port or a range of ports. When omitted, all ports will match. + """ + + type: Optional[Literal["private"]] = None + + vnet_id: Optional[str] = None + """The VNET ID to match the destination. When omitted, all VNETs will match.""" + + +BrowserSSHApplicationDestination: TypeAlias = Union[ + BrowserSSHApplicationDestinationPublicDestination, BrowserSSHApplicationDestinationPrivateDestination +] + + class BrowserSSHApplicationPolicy(ApplicationPolicy): precedence: Optional[int] = None """The order of execution for this policy. @@ -407,8 +589,55 @@ class BrowserSSHApplicationPolicy(ApplicationPolicy): """ +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BrowserSSHApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -593,20 +822,47 @@ class BrowserSSHApplication(BaseModel): updated_at: Optional[datetime] = None -class BrowserVNCApplicationDestination(BaseModel): - type: Optional[Literal["public", "private"]] = None +class BrowserVNCApplicationDestinationPublicDestination(BaseModel): + type: Optional[Literal["public"]] = None uri: Optional[str] = None """The URI of the destination. - Public destinations can include a domain and path with + Public destinations' URIs can include a domain and path with [wildcards](https://developers.cloudflare.com/cloudflare-one/policies/access/app-paths/). - Private destinations are an early access feature and gated behind a feature - flag. Private destinations support private IPv4, IPv6, and Server Name - Indications (SNI) with optional port ranges. """ +class BrowserVNCApplicationDestinationPrivateDestination(BaseModel): + cidr: Optional[str] = None + """The CIDR range of the destination. Single IPs will be computed as /32.""" + + hostname: Optional[str] = None + """The hostname of the destination. Matches a valid SNI served by an HTTPS origin.""" + + l4_protocol: Optional[Literal["tcp", "udp"]] = None + """The L4 protocol of the destination. + + When omitted, both UDP and TCP traffic will match. + """ + + port_range: Optional[str] = None + """The port range of the destination. + + Can be a single port or a range of ports. When omitted, all ports will match. + """ + + type: Optional[Literal["private"]] = None + + vnet_id: Optional[str] = None + """The VNET ID to match the destination. When omitted, all VNETs will match.""" + + +BrowserVNCApplicationDestination: TypeAlias = Union[ + BrowserVNCApplicationDestinationPublicDestination, BrowserVNCApplicationDestinationPrivateDestination +] + + class BrowserVNCApplicationPolicy(ApplicationPolicy): precedence: Optional[int] = None """The order of execution for this policy. @@ -615,8 +871,55 @@ class BrowserVNCApplicationPolicy(ApplicationPolicy): """ +class BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BrowserVNCApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[BrowserVNCApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -834,8 +1137,55 @@ class AppLauncherApplicationPolicy(ApplicationPolicy): """ +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + AppLauncherApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -976,8 +1326,57 @@ class DeviceEnrollmentPermissionsApplicationPolicy(ApplicationPolicy): """ +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1118,8 +1517,57 @@ class BrowserIsolationPermissionsApplicationPolicy(ApplicationPolicy): """ +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BrowserIsolationPermissionsApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1227,8 +1675,55 @@ class BrowserIsolationPermissionsApplication(BaseModel): updated_at: Optional[datetime] = None +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + BookmarkApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] @@ -1376,8 +1871,55 @@ class InfrastructureApplicationPolicy(BaseModel): updated_at: Optional[datetime] = None +class InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken(BaseModel): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken( + BaseModel +): + client_id: str + """ + Client ID of the Access service token used to authenticate with the remote + service. + """ + + client_secret: str + """ + Client secret of the Access service token used to authenticate with the remote + service. + """ + + scheme: Literal["access_service_token"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication: TypeAlias = Union[ + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, +] + InfrastructureApplicationSCIMConfigAuthentication: TypeAlias = Union[ - SCIMConfigAuthenticationHTTPBasic, SCIMConfigAuthenticationOAuthBearerToken, SCIMConfigAuthenticationOauth2 + SCIMConfigAuthenticationHTTPBasic, + SCIMConfigAuthenticationOAuthBearerToken, + SCIMConfigAuthenticationOauth2, + InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationAccessServiceToken, + List[InfrastructureApplicationSCIMConfigAuthenticationAccessSCIMConfigMultiAuthentication], ] diff --git a/src/cloudflare/types/zero_trust/access/gateway_ca_create_response.py b/src/cloudflare/types/zero_trust/access/gateway_ca_create_response.py new file mode 100644 index 00000000000..42288b6edad --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/gateway_ca_create_response.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["GatewayCACreateResponse"] + + +class GatewayCACreateResponse(BaseModel): + id: Optional[str] = None + """The key ID of this certificate.""" + + public_key: Optional[str] = None + """The public key of this certificate.""" diff --git a/src/cloudflare/types/zero_trust/access/gateway_ca_delete_response.py b/src/cloudflare/types/zero_trust/access/gateway_ca_delete_response.py new file mode 100644 index 00000000000..a30c09026e1 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/gateway_ca_delete_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["GatewayCADeleteResponse"] + + +class GatewayCADeleteResponse(BaseModel): + id: Optional[str] = None + """UUID""" diff --git a/src/cloudflare/types/zero_trust/access/gateway_ca_list_response.py b/src/cloudflare/types/zero_trust/access/gateway_ca_list_response.py new file mode 100644 index 00000000000..4a1ebc3f0b2 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/gateway_ca_list_response.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["GatewayCAListResponse"] + + +class GatewayCAListResponse(BaseModel): + id: Optional[str] = None + """The key ID of this certificate.""" + + public_key: Optional[str] = None + """The public key of this certificate.""" diff --git a/src/cloudflare/types/zero_trust/access/infrastructure/target_list_params.py b/src/cloudflare/types/zero_trust/access/infrastructure/target_list_params.py index fae2ccc7255..fb6f96ce9ad 100644 --- a/src/cloudflare/types/zero_trust/access/infrastructure/target_list_params.py +++ b/src/cloudflare/types/zero_trust/access/infrastructure/target_list_params.py @@ -2,9 +2,9 @@ from __future__ import annotations -from typing import Union, Optional +from typing import List, Union, Optional from datetime import datetime -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import Literal, Required, Annotated, TypedDict from ....._utils import PropertyInfo @@ -16,7 +16,13 @@ class TargetListParams(TypedDict, total=False): """Account identifier""" created_after: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] - """Date and time at which the target was created""" + """Date and time at which the target was created after (inclusive)""" + + created_before: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + """Date and time at which the target was created before (inclusive)""" + + direction: Literal["asc", "desc"] + """The sorting direction.""" hostname: Optional[str] """Hostname of a target""" @@ -30,8 +36,20 @@ class TargetListParams(TypedDict, total=False): ip_v6: Optional[str] """IPv6 address of the target""" + ips: List[str] + """Filters for targets that have any of the following IP addresses. + + Specify `ips` multiple times in query parameter to build list of candidates. + """ + modified_after: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] - """Date and time at which the target was modified""" + """Date and time at which the target was modified after (inclusive)""" + + modified_before: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + """Date and time at which the target was modified before (inclusive)""" + + order: Literal["hostname", "created_at"] + """The field to sort by.""" page: int """Current page in the response""" diff --git a/src/cloudflare/types/zero_trust/device_get_response.py b/src/cloudflare/types/zero_trust/device_get_response.py index 0b11c5ec1cc..12ecc5f039a 100644 --- a/src/cloudflare/types/zero_trust/device_get_response.py +++ b/src/cloudflare/types/zero_trust/device_get_response.py @@ -1,8 +1,83 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional -from typing_extensions import TypeAlias +from typing import Optional +from datetime import datetime -__all__ = ["DeviceGetResponse"] +from ..._models import BaseModel -DeviceGetResponse: TypeAlias = Union[Optional[str], Optional[object]] +__all__ = ["DeviceGetResponse", "Account", "User"] + + +class Account(BaseModel): + id: Optional[str] = None + + account_type: Optional[str] = None + + name: Optional[str] = None + """The name of the enrolled account.""" + + +class User(BaseModel): + id: Optional[str] = None + """UUID""" + + email: Optional[str] = None + """The contact email address of the user.""" + + name: Optional[str] = None + """The enrolled device user's name.""" + + +class DeviceGetResponse(BaseModel): + id: Optional[str] = None + """Device ID.""" + + account: Optional[Account] = None + + created: Optional[datetime] = None + """When the device was created.""" + + deleted: Optional[bool] = None + """True if the device was deleted.""" + + device_type: Optional[str] = None + + gateway_device_id: Optional[str] = None + + ip: Optional[str] = None + """IPv4 or IPv6 address.""" + + key: Optional[str] = None + """The device's public key.""" + + key_type: Optional[str] = None + """Type of the key.""" + + last_seen: Optional[datetime] = None + """When the device last connected to Cloudflare services.""" + + mac_address: Optional[str] = None + """The device mac address.""" + + model: Optional[str] = None + """The device model name.""" + + name: Optional[str] = None + """The device name.""" + + os_version: Optional[str] = None + """The operating system version.""" + + serial_number: Optional[str] = None + """The device serial number.""" + + tunnel_type: Optional[str] = None + """Type of the tunnel connection used.""" + + updated: Optional[datetime] = None + """When the device was updated.""" + + user: Optional[User] = None + + version: Optional[str] = None + """The WARP client version.""" diff --git a/src/cloudflare/types/zero_trust/devices/policies/default/certificate_edit_response.py b/src/cloudflare/types/zero_trust/devices/policies/default/certificate_edit_response.py index 0cd113c6420..b74cd9b2576 100644 --- a/src/cloudflare/types/zero_trust/devices/policies/default/certificate_edit_response.py +++ b/src/cloudflare/types/zero_trust/devices/policies/default/certificate_edit_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["CertificateEditResponse"] -CertificateEditResponse: TypeAlias = Union[Optional[str], Optional[object]] +CertificateEditResponse: TypeAlias = Union[str, object, None] diff --git a/src/cloudflare/types/zero_trust/devices/policies/default/certificate_get_response.py b/src/cloudflare/types/zero_trust/devices/policies/default/certificate_get_response.py index 055be51f531..47253a71db8 100644 --- a/src/cloudflare/types/zero_trust/devices/policies/default/certificate_get_response.py +++ b/src/cloudflare/types/zero_trust/devices/policies/default/certificate_get_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["CertificateGetResponse"] -CertificateGetResponse: TypeAlias = Union[Optional[str], Optional[object]] +CertificateGetResponse: TypeAlias = Union[str, object, None] diff --git a/src/cloudflare/types/zero_trust/devices/posture/integration_delete_response.py b/src/cloudflare/types/zero_trust/devices/posture/integration_delete_response.py index df93cf5607b..5ad6c5cee94 100644 --- a/src/cloudflare/types/zero_trust/devices/posture/integration_delete_response.py +++ b/src/cloudflare/types/zero_trust/devices/posture/integration_delete_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["IntegrationDeleteResponse"] -IntegrationDeleteResponse: TypeAlias = Union[Optional[str], Optional[object]] +IntegrationDeleteResponse: TypeAlias = Union[str, object, None] diff --git a/src/cloudflare/types/zero_trust/devices/revoke_create_response.py b/src/cloudflare/types/zero_trust/devices/revoke_create_response.py index 09aceb4935f..42834980772 100644 --- a/src/cloudflare/types/zero_trust/devices/revoke_create_response.py +++ b/src/cloudflare/types/zero_trust/devices/revoke_create_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["RevokeCreateResponse"] -RevokeCreateResponse: TypeAlias = Union[Optional[str], Optional[object]] +RevokeCreateResponse: TypeAlias = Union[str, object, None] diff --git a/src/cloudflare/types/zero_trust/devices/unrevoke_create_response.py b/src/cloudflare/types/zero_trust/devices/unrevoke_create_response.py index 4b3977f4e98..80dd27e6b84 100644 --- a/src/cloudflare/types/zero_trust/devices/unrevoke_create_response.py +++ b/src/cloudflare/types/zero_trust/devices/unrevoke_create_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["UnrevokeCreateResponse"] -UnrevokeCreateResponse: TypeAlias = Union[Optional[str], Optional[object]] +UnrevokeCreateResponse: TypeAlias = Union[str, object, None] diff --git a/src/cloudflare/types/zero_trust/dex/commands/__init__.py b/src/cloudflare/types/zero_trust/dex/commands/__init__.py index 83304891f5e..cf51077364d 100644 --- a/src/cloudflare/types/zero_trust/dex/commands/__init__.py +++ b/src/cloudflare/types/zero_trust/dex/commands/__init__.py @@ -2,4 +2,8 @@ from __future__ import annotations +from .user_list_params import UserListParams as UserListParams +from .device_list_params import DeviceListParams as DeviceListParams from .quota_get_response import QuotaGetResponse as QuotaGetResponse +from .user_list_response import UserListResponse as UserListResponse +from .device_list_response import DeviceListResponse as DeviceListResponse diff --git a/src/cloudflare/types/zero_trust/dex/commands/device_list_params.py b/src/cloudflare/types/zero_trust/dex/commands/device_list_params.py new file mode 100644 index 00000000000..126d1a8cb20 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dex/commands/device_list_params.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["DeviceListParams"] + + +class DeviceListParams(TypedDict, total=False): + account_id: Required[str] + + page: Required[float] + """Page number of paginated results""" + + per_page: Required[float] + """Number of items per page""" + + search: str + """Filter devices by name or email""" diff --git a/src/cloudflare/types/zero_trust/dex/commands/device_list_response.py b/src/cloudflare/types/zero_trust/dex/commands/device_list_response.py new file mode 100644 index 00000000000..5fb1c642279 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dex/commands/device_list_response.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ....._models import BaseModel + +__all__ = ["DeviceListResponse", "Device"] + + +class Device(BaseModel): + device_id: Optional[str] = FieldInfo(alias="deviceId", default=None) + """Device identifier (UUID v4)""" + + device_name: Optional[str] = FieldInfo(alias="deviceName", default=None) + """Device identifier (human readable)""" + + person_email: Optional[str] = FieldInfo(alias="personEmail", default=None) + """User contact email address""" + + platform: Optional[str] = None + """Operating system""" + + status: Optional[str] = None + """Network status""" + + timestamp: Optional[str] = None + """Timestamp in ISO format""" + + version: Optional[str] = None + """WARP client version""" + + +class DeviceListResponse(BaseModel): + devices: Optional[List[Device]] = None + """List of eligible devices""" diff --git a/src/cloudflare/types/zero_trust/dex/commands/user_list_params.py b/src/cloudflare/types/zero_trust/dex/commands/user_list_params.py new file mode 100644 index 00000000000..753ca290284 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dex/commands/user_list_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["UserListParams"] + + +class UserListParams(TypedDict, total=False): + account_id: Required[str] + + search: str + """filter user emails by search""" diff --git a/src/cloudflare/types/zero_trust/dex/commands/user_list_response.py b/src/cloudflare/types/zero_trust/dex/commands/user_list_response.py new file mode 100644 index 00000000000..d2394cc4a99 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dex/commands/user_list_response.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ....._models import BaseModel + +__all__ = ["UserListResponse"] + + +class UserListResponse(BaseModel): + user_emails: Optional[List[str]] = FieldInfo(alias="userEmails", default=None) + """List of user emails""" diff --git a/src/cloudflare/types/zero_trust/dlp/dataset.py b/src/cloudflare/types/zero_trust/dlp/dataset.py index a7f2b015e78..88fe2483702 100644 --- a/src/cloudflare/types/zero_trust/dlp/dataset.py +++ b/src/cloudflare/types/zero_trust/dlp/dataset.py @@ -45,6 +45,10 @@ class Dataset(BaseModel): status: Literal["empty", "uploading", "processing", "failed", "complete"] updated_at: datetime + """When the dataset was last updated. + + This includes name or description changes as well as uploads. + """ uploads: List[Upload] diff --git a/src/cloudflare/types/zero_trust/dlp/email/__init__.py b/src/cloudflare/types/zero_trust/dlp/email/__init__.py new file mode 100644 index 00000000000..d6f82bc8871 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/email/__init__.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .rule_get_response import RuleGetResponse as RuleGetResponse +from .rule_create_params import RuleCreateParams as RuleCreateParams +from .rule_list_response import RuleListResponse as RuleListResponse +from .rule_update_params import RuleUpdateParams as RuleUpdateParams +from .rule_create_response import RuleCreateResponse as RuleCreateResponse +from .rule_delete_response import RuleDeleteResponse as RuleDeleteResponse +from .rule_update_response import RuleUpdateResponse as RuleUpdateResponse +from .rule_bulk_edit_params import RuleBulkEditParams as RuleBulkEditParams +from .rule_bulk_edit_response import RuleBulkEditResponse as RuleBulkEditResponse +from .account_mapping_get_response import AccountMappingGetResponse as AccountMappingGetResponse +from .account_mapping_create_params import AccountMappingCreateParams as AccountMappingCreateParams +from .account_mapping_create_response import AccountMappingCreateResponse as AccountMappingCreateResponse diff --git a/src/cloudflare/types/zero_trust/dlp/email/account_mapping_create_params.py b/src/cloudflare/types/zero_trust/dlp/email/account_mapping_create_params.py new file mode 100644 index 00000000000..0c6ebbedd48 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/email/account_mapping_create_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +__all__ = ["AccountMappingCreateParams", "AuthRequirements", "AuthRequirementsUnionMember0", "AuthRequirementsType"] + + +class AccountMappingCreateParams(TypedDict, total=False): + account_id: Required[str] + + auth_requirements: Required[AuthRequirements] + + +class AuthRequirementsUnionMember0(TypedDict, total=False): + allowed_microsoft_organizations: Required[List[str]] + + type: Required[Literal["Org"]] + + +class AuthRequirementsType(TypedDict, total=False): + type: Required[Literal["NoAuth"]] + + +AuthRequirements: TypeAlias = Union[AuthRequirementsUnionMember0, AuthRequirementsType] diff --git a/src/cloudflare/types/zero_trust/dlp/email/account_mapping_create_response.py b/src/cloudflare/types/zero_trust/dlp/email/account_mapping_create_response.py new file mode 100644 index 00000000000..5be7c141a7d --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/email/account_mapping_create_response.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union +from typing_extensions import Literal, TypeAlias + +from ....._models import BaseModel + +__all__ = ["AccountMappingCreateResponse", "AuthRequirements", "AuthRequirementsUnionMember0", "AuthRequirementsType"] + + +class AuthRequirementsUnionMember0(BaseModel): + allowed_microsoft_organizations: List[str] + + type: Literal["Org"] + + +class AuthRequirementsType(BaseModel): + type: Literal["NoAuth"] + + +AuthRequirements: TypeAlias = Union[AuthRequirementsUnionMember0, AuthRequirementsType] + + +class AccountMappingCreateResponse(BaseModel): + addin_identifier_token: str + + auth_requirements: AuthRequirements diff --git a/src/cloudflare/types/zero_trust/dlp/email/account_mapping_get_response.py b/src/cloudflare/types/zero_trust/dlp/email/account_mapping_get_response.py new file mode 100644 index 00000000000..2b3be1a1c92 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/email/account_mapping_get_response.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union +from typing_extensions import Literal, TypeAlias + +from ....._models import BaseModel + +__all__ = ["AccountMappingGetResponse", "AuthRequirements", "AuthRequirementsUnionMember0", "AuthRequirementsType"] + + +class AuthRequirementsUnionMember0(BaseModel): + allowed_microsoft_organizations: List[str] + + type: Literal["Org"] + + +class AuthRequirementsType(BaseModel): + type: Literal["NoAuth"] + + +AuthRequirements: TypeAlias = Union[AuthRequirementsUnionMember0, AuthRequirementsType] + + +class AccountMappingGetResponse(BaseModel): + addin_identifier_token: str + + auth_requirements: AuthRequirements diff --git a/src/cloudflare/types/zero_trust/dlp/email/rule_bulk_edit_params.py b/src/cloudflare/types/zero_trust/dlp/email/rule_bulk_edit_params.py new file mode 100644 index 00000000000..bd76fa7aa29 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/email/rule_bulk_edit_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict +from typing_extensions import Required, TypedDict + +__all__ = ["RuleBulkEditParams"] + + +class RuleBulkEditParams(TypedDict, total=False): + account_id: Required[str] + + new_priorities: Required[Dict[str, int]] diff --git a/src/cloudflare/types/zero_trust/dlp/email/rule_bulk_edit_response.py b/src/cloudflare/types/zero_trust/dlp/email/rule_bulk_edit_response.py new file mode 100644 index 00000000000..55a9db93b90 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/email/rule_bulk_edit_response.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ....._models import BaseModel + +__all__ = ["RuleBulkEditResponse", "Action", "Condition"] + + +class Action(BaseModel): + action: Literal["Block"] + + message: Optional[str] = None + + +class Condition(BaseModel): + operator: Literal["InList", "NotInList", "MatchRegex", "NotMatchRegex"] + + selector: Literal["Recipients", "Sender", "DLPProfiles"] + + value: object + + +class RuleBulkEditResponse(BaseModel): + action: Action + + conditions: List[Condition] + """Rule is triggered if all conditions match""" + + created_at: datetime + + enabled: bool + + name: str + + priority: int + + rule_id: str + + updated_at: datetime + + description: Optional[str] = None diff --git a/src/cloudflare/types/zero_trust/dlp/email/rule_create_params.py b/src/cloudflare/types/zero_trust/dlp/email/rule_create_params.py new file mode 100644 index 00000000000..8d1bf0f8cd2 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/email/rule_create_params.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["RuleCreateParams", "Action", "Condition"] + + +class RuleCreateParams(TypedDict, total=False): + account_id: Required[str] + + action: Required[Action] + + conditions: Required[Iterable[Condition]] + """Rule is triggered if all conditions match""" + + enabled: Required[bool] + + name: Required[str] + + description: Optional[str] + + +class Action(TypedDict, total=False): + action: Required[Literal["Block"]] + + message: Optional[str] + + +class Condition(TypedDict, total=False): + operator: Required[Literal["InList", "NotInList", "MatchRegex", "NotMatchRegex"]] + + selector: Required[Literal["Recipients", "Sender", "DLPProfiles"]] + + value: Required[object] diff --git a/src/cloudflare/types/zero_trust/dlp/email/rule_create_response.py b/src/cloudflare/types/zero_trust/dlp/email/rule_create_response.py new file mode 100644 index 00000000000..7077679dc93 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/email/rule_create_response.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ....._models import BaseModel + +__all__ = ["RuleCreateResponse", "Action", "Condition"] + + +class Action(BaseModel): + action: Literal["Block"] + + message: Optional[str] = None + + +class Condition(BaseModel): + operator: Literal["InList", "NotInList", "MatchRegex", "NotMatchRegex"] + + selector: Literal["Recipients", "Sender", "DLPProfiles"] + + value: object + + +class RuleCreateResponse(BaseModel): + action: Action + + conditions: List[Condition] + """Rule is triggered if all conditions match""" + + created_at: datetime + + enabled: bool + + name: str + + priority: int + + rule_id: str + + updated_at: datetime + + description: Optional[str] = None diff --git a/src/cloudflare/types/zero_trust/dlp/email/rule_delete_response.py b/src/cloudflare/types/zero_trust/dlp/email/rule_delete_response.py new file mode 100644 index 00000000000..b67309d5e8a --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/email/rule_delete_response.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ....._models import BaseModel + +__all__ = ["RuleDeleteResponse", "Action", "Condition"] + + +class Action(BaseModel): + action: Literal["Block"] + + message: Optional[str] = None + + +class Condition(BaseModel): + operator: Literal["InList", "NotInList", "MatchRegex", "NotMatchRegex"] + + selector: Literal["Recipients", "Sender", "DLPProfiles"] + + value: object + + +class RuleDeleteResponse(BaseModel): + action: Action + + conditions: List[Condition] + """Rule is triggered if all conditions match""" + + created_at: datetime + + enabled: bool + + name: str + + priority: int + + rule_id: str + + updated_at: datetime + + description: Optional[str] = None diff --git a/src/cloudflare/types/zero_trust/dlp/email/rule_get_response.py b/src/cloudflare/types/zero_trust/dlp/email/rule_get_response.py new file mode 100644 index 00000000000..75681ab045e --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/email/rule_get_response.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ....._models import BaseModel + +__all__ = ["RuleGetResponse", "Action", "Condition"] + + +class Action(BaseModel): + action: Literal["Block"] + + message: Optional[str] = None + + +class Condition(BaseModel): + operator: Literal["InList", "NotInList", "MatchRegex", "NotMatchRegex"] + + selector: Literal["Recipients", "Sender", "DLPProfiles"] + + value: object + + +class RuleGetResponse(BaseModel): + action: Action + + conditions: List[Condition] + """Rule is triggered if all conditions match""" + + created_at: datetime + + enabled: bool + + name: str + + priority: int + + rule_id: str + + updated_at: datetime + + description: Optional[str] = None diff --git a/src/cloudflare/types/zero_trust/dlp/email/rule_list_response.py b/src/cloudflare/types/zero_trust/dlp/email/rule_list_response.py new file mode 100644 index 00000000000..0e5913db430 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/email/rule_list_response.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ....._models import BaseModel + +__all__ = ["RuleListResponse", "Action", "Condition"] + + +class Action(BaseModel): + action: Literal["Block"] + + message: Optional[str] = None + + +class Condition(BaseModel): + operator: Literal["InList", "NotInList", "MatchRegex", "NotMatchRegex"] + + selector: Literal["Recipients", "Sender", "DLPProfiles"] + + value: object + + +class RuleListResponse(BaseModel): + action: Action + + conditions: List[Condition] + """Rule is triggered if all conditions match""" + + created_at: datetime + + enabled: bool + + name: str + + priority: int + + rule_id: str + + updated_at: datetime + + description: Optional[str] = None diff --git a/src/cloudflare/types/zero_trust/dlp/email/rule_update_params.py b/src/cloudflare/types/zero_trust/dlp/email/rule_update_params.py new file mode 100644 index 00000000000..1bf1e76cf2f --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/email/rule_update_params.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["RuleUpdateParams", "Action", "Condition"] + + +class RuleUpdateParams(TypedDict, total=False): + account_id: Required[str] + + action: Required[Action] + + conditions: Required[Iterable[Condition]] + """Rule is triggered if all conditions match""" + + enabled: Required[bool] + + name: Required[str] + + description: Optional[str] + + +class Action(TypedDict, total=False): + action: Required[Literal["Block"]] + + message: Optional[str] + + +class Condition(TypedDict, total=False): + operator: Required[Literal["InList", "NotInList", "MatchRegex", "NotMatchRegex"]] + + selector: Required[Literal["Recipients", "Sender", "DLPProfiles"]] + + value: Required[object] diff --git a/src/cloudflare/types/zero_trust/dlp/email/rule_update_response.py b/src/cloudflare/types/zero_trust/dlp/email/rule_update_response.py new file mode 100644 index 00000000000..c1e9f32703d --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/email/rule_update_response.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ....._models import BaseModel + +__all__ = ["RuleUpdateResponse", "Action", "Condition"] + + +class Action(BaseModel): + action: Literal["Block"] + + message: Optional[str] = None + + +class Condition(BaseModel): + operator: Literal["InList", "NotInList", "MatchRegex", "NotMatchRegex"] + + selector: Literal["Recipients", "Sender", "DLPProfiles"] + + value: object + + +class RuleUpdateResponse(BaseModel): + action: Action + + conditions: List[Condition] + """Rule is triggered if all conditions match""" + + created_at: datetime + + enabled: bool + + name: str + + priority: int + + rule_id: str + + updated_at: datetime + + description: Optional[str] = None diff --git a/src/cloudflare/types/zero_trust/gateway/configuration_edit_params.py b/src/cloudflare/types/zero_trust/gateway/configuration_edit_params.py index 9adb3f5ae01..e2a203f8dd8 100644 --- a/src/cloudflare/types/zero_trust/gateway/configuration_edit_params.py +++ b/src/cloudflare/types/zero_trust/gateway/configuration_edit_params.py @@ -13,4 +13,4 @@ class ConfigurationEditParams(TypedDict, total=False): account_id: Required[str] settings: GatewayConfigurationSettingsParam - """account settings.""" + """Account settings""" diff --git a/src/cloudflare/types/zero_trust/gateway/configuration_edit_response.py b/src/cloudflare/types/zero_trust/gateway/configuration_edit_response.py index e7659cf264e..13a39732b9b 100644 --- a/src/cloudflare/types/zero_trust/gateway/configuration_edit_response.py +++ b/src/cloudflare/types/zero_trust/gateway/configuration_edit_response.py @@ -13,6 +13,6 @@ class ConfigurationEditResponse(BaseModel): created_at: Optional[datetime] = None settings: Optional[GatewayConfigurationSettings] = None - """account settings.""" + """Account settings""" updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/gateway/configuration_get_response.py b/src/cloudflare/types/zero_trust/gateway/configuration_get_response.py index ab5d764c721..63636f9ea17 100644 --- a/src/cloudflare/types/zero_trust/gateway/configuration_get_response.py +++ b/src/cloudflare/types/zero_trust/gateway/configuration_get_response.py @@ -13,6 +13,6 @@ class ConfigurationGetResponse(BaseModel): created_at: Optional[datetime] = None settings: Optional[GatewayConfigurationSettings] = None - """account settings.""" + """Account settings""" updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/gateway/configuration_update_params.py b/src/cloudflare/types/zero_trust/gateway/configuration_update_params.py index 7fcc1d00377..8dc9dece583 100644 --- a/src/cloudflare/types/zero_trust/gateway/configuration_update_params.py +++ b/src/cloudflare/types/zero_trust/gateway/configuration_update_params.py @@ -13,4 +13,4 @@ class ConfigurationUpdateParams(TypedDict, total=False): account_id: Required[str] settings: GatewayConfigurationSettingsParam - """account settings.""" + """Account settings""" diff --git a/src/cloudflare/types/zero_trust/gateway/configuration_update_response.py b/src/cloudflare/types/zero_trust/gateway/configuration_update_response.py index f88c116ea7e..17c9c505bf3 100644 --- a/src/cloudflare/types/zero_trust/gateway/configuration_update_response.py +++ b/src/cloudflare/types/zero_trust/gateway/configuration_update_response.py @@ -13,6 +13,6 @@ class ConfigurationUpdateResponse(BaseModel): created_at: Optional[datetime] = None settings: Optional[GatewayConfigurationSettings] = None - """account settings.""" + """Account settings""" updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/gateway/gateway_rule.py b/src/cloudflare/types/zero_trust/gateway/gateway_rule.py index 0f312358eea..ba61ea684bd 100644 --- a/src/cloudflare/types/zero_trust/gateway/gateway_rule.py +++ b/src/cloudflare/types/zero_trust/gateway/gateway_rule.py @@ -117,3 +117,6 @@ class GatewayRule(BaseModel): """The wirefilter expression used for traffic matching.""" updated_at: Optional[datetime] = None + + version: Optional[int] = None + """version number of the rule""" diff --git a/src/cloudflare/types/zero_trust/gateway/list_update_params.py b/src/cloudflare/types/zero_trust/gateway/list_update_params.py index 0177452d00e..d02a3f2a256 100644 --- a/src/cloudflare/types/zero_trust/gateway/list_update_params.py +++ b/src/cloudflare/types/zero_trust/gateway/list_update_params.py @@ -2,8 +2,11 @@ from __future__ import annotations +from typing import Iterable from typing_extensions import Required, TypedDict +from .gateway_item_param import GatewayItemParam + __all__ = ["ListUpdateParams"] @@ -15,3 +18,6 @@ class ListUpdateParams(TypedDict, total=False): description: str """The description of the list.""" + + items: Iterable[GatewayItemParam] + """The items in the list.""" diff --git a/src/cloudflare/types/zero_trust/gateway/location.py b/src/cloudflare/types/zero_trust/gateway/location.py index b13ca136603..a5755c64010 100644 --- a/src/cloudflare/types/zero_trust/gateway/location.py +++ b/src/cloudflare/types/zero_trust/gateway/location.py @@ -25,6 +25,13 @@ class Location(BaseModel): dns_destination_ips_id: Optional[str] = None """The identifier of the pair of IPv4 addresses assigned to this location.""" + dns_destination_ipv6_block_id: Optional[str] = None + """ + The uuid identifier of the IPv6 block brought to the gateway, so that this + location's IPv6 address is allocated from the Bring Your Own Ipv6(BYOIPv6) block + and not from the standard CloudFlare IPv6 block. + """ + doh_subdomain: Optional[str] = None """The DNS over HTTPS domain to send DNS requests to. diff --git a/src/cloudflare/types/zero_trust/gateway/rule_setting.py b/src/cloudflare/types/zero_trust/gateway/rule_setting.py index 60b6eff04c4..3d73a0b442c 100644 --- a/src/cloudflare/types/zero_trust/gateway/rule_setting.py +++ b/src/cloudflare/types/zero_trust/gateway/rule_setting.py @@ -18,6 +18,7 @@ "NotificationSettings", "PayloadLog", "Quarantine", + "ResolveDNSInternally", "UntrustedCERT", ] @@ -107,6 +108,18 @@ class Quarantine(BaseModel): """Types of files to sandbox.""" +class ResolveDNSInternally(BaseModel): + fallback: Optional[Literal["none", "public_dns"]] = None + """ + The fallback behavior to apply when the internal DNS response code is different + from 'NOERROR' or when the response data only contains CNAME records for 'A' or + 'AAAA' queries. + """ + + view_id: Optional[str] = None + """The internal DNS view identifier that's passed to the internal DNS service.""" + + class UntrustedCERT(BaseModel): action: Optional[Literal["pass_through", "block", "error"]] = None """The action performed when an untrusted certificate is seen. @@ -149,9 +162,9 @@ class RuleSetting(BaseModel): dns_resolvers: Optional[DNSResolvers] = None """Add your own custom resolvers to route queries that match the resolver policy. - Cannot be used when resolve_dns_through_cloudflare is set. DNS queries will - route to the address closest to their origin. Only valid when a rule's action is - set to 'resolve'. + Cannot be used when 'resolve_dns_through_cloudflare' or 'resolve_dns_internally' + are set. DNS queries will route to the address closest to their origin. Only + valid when a rule's action is set to 'resolve'. """ egress: Optional[Egress] = None @@ -204,11 +217,20 @@ class RuleSetting(BaseModel): quarantine: Optional[Quarantine] = None """Settings that apply to quarantine rules""" + resolve_dns_internally: Optional[ResolveDNSInternally] = None + """ + Configure to forward the query to the internal DNS service, passing the + specified 'view_id' as input. Cannot be set when 'dns_resolvers' are specified + or 'resolve_dns_through_cloudflare' is set. Only valid when a rule's action is + set to 'resolve'. + """ + resolve_dns_through_cloudflare: Optional[bool] = None """ Enable to send queries that match the policy to Cloudflare's default 1.1.1.1 DNS - resolver. Cannot be set when dns_resolvers are specified. Only valid when a - rule's action is set to 'resolve'. + resolver. Cannot be set when 'dns_resolvers' are specified or + 'resolve_dns_internally' is set. Only valid when a rule's action is set to + 'resolve'. """ untrusted_cert: Optional[UntrustedCERT] = None diff --git a/src/cloudflare/types/zero_trust/gateway/rule_setting_param.py b/src/cloudflare/types/zero_trust/gateway/rule_setting_param.py index 11da19fb61f..6f3884920e2 100644 --- a/src/cloudflare/types/zero_trust/gateway/rule_setting_param.py +++ b/src/cloudflare/types/zero_trust/gateway/rule_setting_param.py @@ -19,6 +19,7 @@ "NotificationSettings", "PayloadLog", "Quarantine", + "ResolveDNSInternally", "UntrustedCERT", ] @@ -108,6 +109,18 @@ class Quarantine(TypedDict, total=False): """Types of files to sandbox.""" +class ResolveDNSInternally(TypedDict, total=False): + fallback: Literal["none", "public_dns"] + """ + The fallback behavior to apply when the internal DNS response code is different + from 'NOERROR' or when the response data only contains CNAME records for 'A' or + 'AAAA' queries. + """ + + view_id: str + """The internal DNS view identifier that's passed to the internal DNS service.""" + + class UntrustedCERT(TypedDict, total=False): action: Literal["pass_through", "block", "error"] """The action performed when an untrusted certificate is seen. @@ -150,9 +163,9 @@ class RuleSettingParam(TypedDict, total=False): dns_resolvers: DNSResolvers """Add your own custom resolvers to route queries that match the resolver policy. - Cannot be used when resolve_dns_through_cloudflare is set. DNS queries will - route to the address closest to their origin. Only valid when a rule's action is - set to 'resolve'. + Cannot be used when 'resolve_dns_through_cloudflare' or 'resolve_dns_internally' + are set. DNS queries will route to the address closest to their origin. Only + valid when a rule's action is set to 'resolve'. """ egress: Egress @@ -205,11 +218,20 @@ class RuleSettingParam(TypedDict, total=False): quarantine: Quarantine """Settings that apply to quarantine rules""" + resolve_dns_internally: ResolveDNSInternally + """ + Configure to forward the query to the internal DNS service, passing the + specified 'view_id' as input. Cannot be set when 'dns_resolvers' are specified + or 'resolve_dns_through_cloudflare' is set. Only valid when a rule's action is + set to 'resolve'. + """ + resolve_dns_through_cloudflare: bool """ Enable to send queries that match the policy to Cloudflare's default 1.1.1.1 DNS - resolver. Cannot be set when dns_resolvers are specified. Only valid when a - rule's action is set to 'resolve'. + resolver. Cannot be set when 'dns_resolvers' are specified or + 'resolve_dns_internally' is set. Only valid when a rule's action is set to + 'resolve'. """ untrusted_cert: UntrustedCERT diff --git a/src/cloudflare/types/zero_trust/identity_provider_scim_config.py b/src/cloudflare/types/zero_trust/identity_provider_scim_config.py index 3f664fe6216..aa4b9fecffe 100644 --- a/src/cloudflare/types/zero_trust/identity_provider_scim_config.py +++ b/src/cloudflare/types/zero_trust/identity_provider_scim_config.py @@ -23,6 +23,9 @@ class IdentityProviderSCIMConfig(BaseModel): updates in any way and users will not be prompted to reauthenticate. """ + scim_base_url: Optional[str] = None + """The base URL of Cloudflare's SCIM V2.0 API endpoint.""" + seat_deprovision: Optional[bool] = None """ A flag to remove a user's seat in Zero Trust when they have been deprovisioned @@ -34,7 +37,7 @@ class IdentityProviderSCIMConfig(BaseModel): """ A read-only token generated when the SCIM integration is enabled for the first time. It is redacted on subsequent requests. If you lose this you will need to - refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + refresh it at /access/identity_providers/:idpID/refresh_scim_secret. """ user_deprovision: Optional[bool] = None diff --git a/src/cloudflare/types/zero_trust/organizations/doh_get_response.py b/src/cloudflare/types/zero_trust/organizations/doh_get_response.py index 45cb3c7a793..adb3be9867c 100644 --- a/src/cloudflare/types/zero_trust/organizations/doh_get_response.py +++ b/src/cloudflare/types/zero_trust/organizations/doh_get_response.py @@ -20,6 +20,14 @@ class DOHGetResponse(BaseModel): created_at: Optional[datetime] = None + doh_jwt_duration: Optional[str] = None + """The duration the DoH JWT is valid for. + + Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), + ms, s, m, h. Note that the maximum duration for this setting is the same as the + key rotation period on the account. + """ + duration: Optional[str] = None """The duration for how long the service token will be valid. @@ -29,14 +37,6 @@ class DOHGetResponse(BaseModel): expires_at: Optional[datetime] = None - jwt_duration: Optional[str] = None - """The duration the DoH JWT is valid for. - - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. Note that the maximum duration for this setting is the same as the - key rotation period on the account. - """ - name: Optional[str] = None """The name of the service token.""" diff --git a/src/cloudflare/types/zero_trust/organizations/doh_update_params.py b/src/cloudflare/types/zero_trust/organizations/doh_update_params.py index 46ff3ae5df6..2392abf7fe0 100644 --- a/src/cloudflare/types/zero_trust/organizations/doh_update_params.py +++ b/src/cloudflare/types/zero_trust/organizations/doh_update_params.py @@ -11,7 +11,7 @@ class DOHUpdateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - jwt_duration: str + doh_jwt_duration: str """The duration the DoH JWT is valid for. Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), diff --git a/src/cloudflare/types/zero_trust/organizations/doh_update_response.py b/src/cloudflare/types/zero_trust/organizations/doh_update_response.py index 4a9196368f9..128469eebb3 100644 --- a/src/cloudflare/types/zero_trust/organizations/doh_update_response.py +++ b/src/cloudflare/types/zero_trust/organizations/doh_update_response.py @@ -20,6 +20,14 @@ class DOHUpdateResponse(BaseModel): created_at: Optional[datetime] = None + doh_jwt_duration: Optional[str] = None + """The duration the DoH JWT is valid for. + + Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), + ms, s, m, h. Note that the maximum duration for this setting is the same as the + key rotation period on the account. Default expiration is 24h + """ + duration: Optional[str] = None """The duration for how long the service token will be valid. @@ -29,14 +37,6 @@ class DOHUpdateResponse(BaseModel): expires_at: Optional[datetime] = None - jwt_duration: Optional[str] = None - """The duration the DoH JWT is valid for. - - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. Note that the maximum duration for this setting is the same as the - key rotation period on the account. Default expiration is 24h - """ - name: Optional[str] = None """The name of the service token.""" diff --git a/src/cloudflare/types/zones/__init__.py b/src/cloudflare/types/zones/__init__.py index f82d8f8e328..5b7501b8935 100644 --- a/src/cloudflare/types/zones/__init__.py +++ b/src/cloudflare/types/zones/__init__.py @@ -49,6 +49,7 @@ from .websocket_param import WebsocketParam as WebsocketParam from .always_use_https import AlwaysUseHTTPS as AlwaysUseHTTPS from .development_mode import DevelopmentMode as DevelopmentMode +from .hold_edit_params import HoldEditParams as HoldEditParams from .orange_to_orange import OrangeToOrange as OrangeToOrange from .prefetch_preload import PrefetchPreload as PrefetchPreload from .security_headers import SecurityHeaders as SecurityHeaders @@ -94,7 +95,6 @@ from .browser_cache_ttl_param import BrowserCacheTTLParam as BrowserCacheTTLParam from .email_obfuscation_param import EmailObfuscationParam as EmailObfuscationParam from .h2_prioritization_param import H2PrioritizationParam as H2PrioritizationParam -from .origin_max_http_version import OriginMaxHTTPVersion as OriginMaxHTTPVersion from .automatic_https_rewrites import AutomaticHTTPSRewrites as AutomaticHTTPSRewrites from .hotlink_protection_param import HotlinkProtectionParam as HotlinkProtectionParam from .opportunistic_encryption import OpportunisticEncryption as OpportunisticEncryption diff --git a/src/cloudflare/types/zones/hold_edit_params.py b/src/cloudflare/types/zones/hold_edit_params.py new file mode 100644 index 00000000000..fc5e878576f --- /dev/null +++ b/src/cloudflare/types/zones/hold_edit_params.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["HoldEditParams"] + + +class HoldEditParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + hold_after: str + """ + If `hold_after` is provided and future-dated, the hold will be temporarily + disabled, then automatically re-enabled by the system at the time specified in + this RFC3339-formatted timestamp. A past-dated `hold_after` value will have no + effect on an existing, enabled hold. Providing an empty string will set its + value to the current time. + """ + + include_subdomains: bool + """ + If `true`, the zone hold will extend to block any subdomain of the given zone, + as well as SSL4SaaS Custom Hostnames. For example, a zone hold on a zone with + the hostname 'example.com' and include_subdomains=true will block 'example.com', + 'staging.example.com', 'api.staging.example.com', etc. + """ diff --git a/src/cloudflare/types/zones/origin_max_http_version.py b/src/cloudflare/types/zones/origin_max_http_version.py deleted file mode 100644 index 4572b289282..00000000000 --- a/src/cloudflare/types/zones/origin_max_http_version.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal, TypeAlias - -__all__ = ["OriginMaxHTTPVersion"] - -OriginMaxHTTPVersion: TypeAlias = Literal["origin_max_http_version"] diff --git a/tests/api_resources/addressing/loa_documents/__init__.py b/tests/api_resources/accounts/logs/__init__.py similarity index 100% rename from tests/api_resources/addressing/loa_documents/__init__.py rename to tests/api_resources/accounts/logs/__init__.py diff --git a/tests/api_resources/accounts/logs/test_audit.py b/tests/api_resources/accounts/logs/test_audit.py new file mode 100644 index 00000000000..0c9faafda0e --- /dev/null +++ b/tests/api_resources/accounts/logs/test_audit.py @@ -0,0 +1,192 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare._utils import parse_date +from cloudflare.pagination import SyncCursorLimitPagination, AsyncCursorLimitPagination +from cloudflare.types.accounts.logs import AuditListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAudit: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="TODO:investigate broken test") + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + audit = client.accounts.logs.audit.list( + account_id="a67e14daa5f8dceeb91fe5449ba496ef", + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), + ) + assert_matches_type(SyncCursorLimitPagination[AuditListResponse], audit, path=["response"]) + + @pytest.mark.skip(reason="TODO:investigate broken test") + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + audit = client.accounts.logs.audit.list( + account_id="a67e14daa5f8dceeb91fe5449ba496ef", + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), + account_name="account_name", + action_result="success", + action_type="create", + actor_context="api_key", + actor_email="alice@example.com", + actor_id="1d20c3afe174f18b642710cec6298a9d", + actor_ip_address="17.168.228.63", + actor_token_id="144cdb2e39c55e203cf225d8d8208647", + actor_token_name="Test Token", + actor_type="cloudflare_admin", + audit_log_id="f174be97-19b1-40d6-954d-70cd5fbd52db", + cursor="Q1buH-__DQqqig7SVYXT-SsMOTGY2Z3Y80W-fGgva7yaDdmPKveucH5ddOcHsJRhNb-xUK8agZQqkJSMAENGO8NU6g==", + direction="desc", + limit=25, + raw_cf_rayid="8e8dd2156ef28414", + raw_method="GET", + raw_status_code=200, + raw_uri="raw_uri", + resource_id="resource_id", + resource_product="Stream", + resource_scope="accounts", + resource_type="Video", + zone_id="zone_id", + zone_name="example.com", + ) + assert_matches_type(SyncCursorLimitPagination[AuditListResponse], audit, path=["response"]) + + @pytest.mark.skip(reason="TODO:investigate broken test") + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.accounts.logs.audit.with_raw_response.list( + account_id="a67e14daa5f8dceeb91fe5449ba496ef", + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + audit = response.parse() + assert_matches_type(SyncCursorLimitPagination[AuditListResponse], audit, path=["response"]) + + @pytest.mark.skip(reason="TODO:investigate broken test") + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.accounts.logs.audit.with_streaming_response.list( + account_id="a67e14daa5f8dceeb91fe5449ba496ef", + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + audit = response.parse() + assert_matches_type(SyncCursorLimitPagination[AuditListResponse], audit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO:investigate broken test") + @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.accounts.logs.audit.with_raw_response.list( + account_id="", + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), + ) + + +class TestAsyncAudit: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="TODO:investigate broken test") + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + audit = await async_client.accounts.logs.audit.list( + account_id="a67e14daa5f8dceeb91fe5449ba496ef", + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), + ) + assert_matches_type(AsyncCursorLimitPagination[AuditListResponse], audit, path=["response"]) + + @pytest.mark.skip(reason="TODO:investigate broken test") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + audit = await async_client.accounts.logs.audit.list( + account_id="a67e14daa5f8dceeb91fe5449ba496ef", + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), + account_name="account_name", + action_result="success", + action_type="create", + actor_context="api_key", + actor_email="alice@example.com", + actor_id="1d20c3afe174f18b642710cec6298a9d", + actor_ip_address="17.168.228.63", + actor_token_id="144cdb2e39c55e203cf225d8d8208647", + actor_token_name="Test Token", + actor_type="cloudflare_admin", + audit_log_id="f174be97-19b1-40d6-954d-70cd5fbd52db", + cursor="Q1buH-__DQqqig7SVYXT-SsMOTGY2Z3Y80W-fGgva7yaDdmPKveucH5ddOcHsJRhNb-xUK8agZQqkJSMAENGO8NU6g==", + direction="desc", + limit=25, + raw_cf_rayid="8e8dd2156ef28414", + raw_method="GET", + raw_status_code=200, + raw_uri="raw_uri", + resource_id="resource_id", + resource_product="Stream", + resource_scope="accounts", + resource_type="Video", + zone_id="zone_id", + zone_name="example.com", + ) + assert_matches_type(AsyncCursorLimitPagination[AuditListResponse], audit, path=["response"]) + + @pytest.mark.skip(reason="TODO:investigate broken test") + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.accounts.logs.audit.with_raw_response.list( + account_id="a67e14daa5f8dceeb91fe5449ba496ef", + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + audit = await response.parse() + assert_matches_type(AsyncCursorLimitPagination[AuditListResponse], audit, path=["response"]) + + @pytest.mark.skip(reason="TODO:investigate broken test") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.accounts.logs.audit.with_streaming_response.list( + account_id="a67e14daa5f8dceeb91fe5449ba496ef", + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + audit = await response.parse() + assert_matches_type(AsyncCursorLimitPagination[AuditListResponse], audit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO:investigate broken test") + @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.accounts.logs.audit.with_raw_response.list( + account_id="", + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), + ) diff --git a/tests/api_resources/accounts/test_tokens.py b/tests/api_resources/accounts/test_tokens.py index e0b183d7188..dc10d79e1de 100644 --- a/tests/api_resources/accounts/test_tokens.py +++ b/tests/api_resources/accounts/test_tokens.py @@ -34,7 +34,10 @@ def test_method_create(self, client: Cloudflare) -> None: { "effect": "allow", "permission_groups": [{}, {}], - "resources": {}, + "resources": { + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }, } ], ) @@ -64,8 +67,8 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: }, ], "resources": { - "resource": "resource", - "scope": "scope", + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", }, } ], @@ -90,7 +93,10 @@ def test_raw_response_create(self, client: Cloudflare) -> None: { "effect": "allow", "permission_groups": [{}, {}], - "resources": {}, + "resources": { + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }, } ], ) @@ -110,7 +116,10 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: { "effect": "allow", "permission_groups": [{}, {}], - "resources": {}, + "resources": { + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }, } ], ) as response: @@ -133,7 +142,10 @@ def test_path_params_create(self, client: Cloudflare) -> None: { "effect": "allow", "permission_groups": [{}, {}], - "resources": {}, + "resources": { + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }, } ], ) @@ -180,8 +192,8 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: }, ], "resources": { - "resource": "resource", - "scope": "scope", + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", }, } ], @@ -445,7 +457,10 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: { "effect": "allow", "permission_groups": [{}, {}], - "resources": {}, + "resources": { + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }, } ], ) @@ -475,8 +490,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare }, ], "resources": { - "resource": "resource", - "scope": "scope", + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", }, } ], @@ -501,7 +516,10 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: { "effect": "allow", "permission_groups": [{}, {}], - "resources": {}, + "resources": { + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }, } ], ) @@ -521,7 +539,10 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> { "effect": "allow", "permission_groups": [{}, {}], - "resources": {}, + "resources": { + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }, } ], ) as response: @@ -544,7 +565,10 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: { "effect": "allow", "permission_groups": [{}, {}], - "resources": {}, + "resources": { + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }, } ], ) @@ -591,8 +615,8 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare }, ], "resources": { - "resource": "resource", - "scope": "scope", + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", }, } ], diff --git a/tests/api_resources/addressing/address_maps/test_accounts.py b/tests/api_resources/addressing/address_maps/test_accounts.py index b84e7ea91ed..3bb5dc17626 100644 --- a/tests/api_resources/addressing/address_maps/test_accounts.py +++ b/tests/api_resources/addressing/address_maps/test_accounts.py @@ -20,8 +20,8 @@ class TestAccounts: @parametrize def test_method_update(self, client: Cloudflare) -> None: account = client.addressing.address_maps.accounts.update( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", body={}, ) assert_matches_type(AccountUpdateResponse, account, path=["response"]) @@ -29,8 +29,8 @@ def test_method_update(self, client: Cloudflare) -> None: @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: response = client.addressing.address_maps.accounts.with_raw_response.update( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", body={}, ) @@ -42,8 +42,8 @@ def test_raw_response_update(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: with client.addressing.address_maps.accounts.with_streaming_response.update( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", body={}, ) as response: assert not response.is_closed @@ -58,7 +58,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: 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.addressing.address_maps.accounts.with_raw_response.update( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", account_id="", body={}, ) @@ -66,23 +66,23 @@ def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): client.addressing.address_maps.accounts.with_raw_response.update( address_map_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", body={}, ) @parametrize def test_method_delete(self, client: Cloudflare) -> None: account = client.addressing.address_maps.accounts.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(AccountDeleteResponse, account, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.addressing.address_maps.accounts.with_raw_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -93,8 +93,8 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.addressing.address_maps.accounts.with_streaming_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -108,14 +108,14 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: 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.addressing.address_maps.accounts.with_raw_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): client.addressing.address_maps.accounts.with_raw_response.delete( address_map_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) @@ -125,8 +125,8 @@ class TestAsyncAccounts: @parametrize async def test_method_update(self, async_client: AsyncCloudflare) -> None: account = await async_client.addressing.address_maps.accounts.update( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", body={}, ) assert_matches_type(AccountUpdateResponse, account, path=["response"]) @@ -134,8 +134,8 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.address_maps.accounts.with_raw_response.update( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", body={}, ) @@ -147,8 +147,8 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.address_maps.accounts.with_streaming_response.update( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", body={}, ) as response: assert not response.is_closed @@ -163,7 +163,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> 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.addressing.address_maps.accounts.with_raw_response.update( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", account_id="", body={}, ) @@ -171,23 +171,23 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): await async_client.addressing.address_maps.accounts.with_raw_response.update( address_map_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", body={}, ) @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account = await async_client.addressing.address_maps.accounts.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(AccountDeleteResponse, account, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.address_maps.accounts.with_raw_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -198,8 +198,8 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.address_maps.accounts.with_streaming_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -213,12 +213,12 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> 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.addressing.address_maps.accounts.with_raw_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): await async_client.addressing.address_maps.accounts.with_raw_response.delete( address_map_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) diff --git a/tests/api_resources/addressing/address_maps/test_ips.py b/tests/api_resources/addressing/address_maps/test_ips.py index 8525eee077b..63221153f3a 100644 --- a/tests/api_resources/addressing/address_maps/test_ips.py +++ b/tests/api_resources/addressing/address_maps/test_ips.py @@ -21,8 +21,8 @@ class TestIPs: def test_method_update(self, client: Cloudflare) -> None: ip = client.addressing.address_maps.ips.update( ip_address="192.0.2.1", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + address_map_id="055817b111884e0227e1be16a0be6ee0", body={}, ) assert_matches_type(IPUpdateResponse, ip, path=["response"]) @@ -31,8 +31,8 @@ def test_method_update(self, client: Cloudflare) -> None: def test_raw_response_update(self, client: Cloudflare) -> None: response = client.addressing.address_maps.ips.with_raw_response.update( ip_address="192.0.2.1", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + address_map_id="055817b111884e0227e1be16a0be6ee0", body={}, ) @@ -45,8 +45,8 @@ def test_raw_response_update(self, client: Cloudflare) -> None: def test_streaming_response_update(self, client: Cloudflare) -> None: with client.addressing.address_maps.ips.with_streaming_response.update( ip_address="192.0.2.1", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + address_map_id="055817b111884e0227e1be16a0be6ee0", body={}, ) as response: assert not response.is_closed @@ -63,14 +63,14 @@ def test_path_params_update(self, client: Cloudflare) -> None: client.addressing.address_maps.ips.with_raw_response.update( ip_address="192.0.2.1", account_id="", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): client.addressing.address_maps.ips.with_raw_response.update( ip_address="192.0.2.1", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", address_map_id="", body={}, ) @@ -78,8 +78,8 @@ def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ip_address` but received ''"): client.addressing.address_maps.ips.with_raw_response.update( ip_address="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + address_map_id="055817b111884e0227e1be16a0be6ee0", body={}, ) @@ -87,8 +87,8 @@ def test_path_params_update(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: ip = client.addressing.address_maps.ips.delete( ip_address="192.0.2.1", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + address_map_id="055817b111884e0227e1be16a0be6ee0", ) assert_matches_type(IPDeleteResponse, ip, path=["response"]) @@ -96,8 +96,8 @@ def test_method_delete(self, client: Cloudflare) -> None: def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.addressing.address_maps.ips.with_raw_response.delete( ip_address="192.0.2.1", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + address_map_id="055817b111884e0227e1be16a0be6ee0", ) assert response.is_closed is True @@ -109,8 +109,8 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.addressing.address_maps.ips.with_streaming_response.delete( ip_address="192.0.2.1", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + address_map_id="055817b111884e0227e1be16a0be6ee0", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -126,21 +126,21 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.addressing.address_maps.ips.with_raw_response.delete( ip_address="192.0.2.1", account_id="", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): client.addressing.address_maps.ips.with_raw_response.delete( ip_address="192.0.2.1", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", address_map_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `ip_address` but received ''"): client.addressing.address_maps.ips.with_raw_response.delete( ip_address="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + address_map_id="055817b111884e0227e1be16a0be6ee0", ) @@ -151,8 +151,8 @@ class TestAsyncIPs: async def test_method_update(self, async_client: AsyncCloudflare) -> None: ip = await async_client.addressing.address_maps.ips.update( ip_address="192.0.2.1", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + address_map_id="055817b111884e0227e1be16a0be6ee0", body={}, ) assert_matches_type(IPUpdateResponse, ip, path=["response"]) @@ -161,8 +161,8 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.address_maps.ips.with_raw_response.update( ip_address="192.0.2.1", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + address_map_id="055817b111884e0227e1be16a0be6ee0", body={}, ) @@ -175,8 +175,8 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.address_maps.ips.with_streaming_response.update( ip_address="192.0.2.1", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + address_map_id="055817b111884e0227e1be16a0be6ee0", body={}, ) as response: assert not response.is_closed @@ -193,14 +193,14 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: await async_client.addressing.address_maps.ips.with_raw_response.update( ip_address="192.0.2.1", account_id="", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): await async_client.addressing.address_maps.ips.with_raw_response.update( ip_address="192.0.2.1", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", address_map_id="", body={}, ) @@ -208,8 +208,8 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ip_address` but received ''"): await async_client.addressing.address_maps.ips.with_raw_response.update( ip_address="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + address_map_id="055817b111884e0227e1be16a0be6ee0", body={}, ) @@ -217,8 +217,8 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: async def test_method_delete(self, async_client: AsyncCloudflare) -> None: ip = await async_client.addressing.address_maps.ips.delete( ip_address="192.0.2.1", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + address_map_id="055817b111884e0227e1be16a0be6ee0", ) assert_matches_type(IPDeleteResponse, ip, path=["response"]) @@ -226,8 +226,8 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.address_maps.ips.with_raw_response.delete( ip_address="192.0.2.1", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + address_map_id="055817b111884e0227e1be16a0be6ee0", ) assert response.is_closed is True @@ -239,8 +239,8 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.address_maps.ips.with_streaming_response.delete( ip_address="192.0.2.1", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + address_map_id="055817b111884e0227e1be16a0be6ee0", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -256,19 +256,19 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.addressing.address_maps.ips.with_raw_response.delete( ip_address="192.0.2.1", account_id="", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): await async_client.addressing.address_maps.ips.with_raw_response.delete( ip_address="192.0.2.1", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", address_map_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `ip_address` but received ''"): await async_client.addressing.address_maps.ips.with_raw_response.delete( ip_address="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + address_map_id="055817b111884e0227e1be16a0be6ee0", ) diff --git a/tests/api_resources/addressing/address_maps/test_zones.py b/tests/api_resources/addressing/address_maps/test_zones.py index 12786fdfd14..f0fe5d2d2bb 100644 --- a/tests/api_resources/addressing/address_maps/test_zones.py +++ b/tests/api_resources/addressing/address_maps/test_zones.py @@ -20,9 +20,9 @@ class TestZones: @parametrize def test_method_update(self, client: Cloudflare) -> None: zone = client.addressing.address_maps.zones.update( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + zone_id="8ac8489932db6327334c9b6d58544cfe", + account_id="258def64c72dae45f3e4c8516e2111f2", body={}, ) assert_matches_type(ZoneUpdateResponse, zone, path=["response"]) @@ -30,9 +30,9 @@ def test_method_update(self, client: Cloudflare) -> None: @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: response = client.addressing.address_maps.zones.with_raw_response.update( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + zone_id="8ac8489932db6327334c9b6d58544cfe", + account_id="258def64c72dae45f3e4c8516e2111f2", body={}, ) @@ -44,9 +44,9 @@ def test_raw_response_update(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: with client.addressing.address_maps.zones.with_streaming_response.update( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + zone_id="8ac8489932db6327334c9b6d58544cfe", + account_id="258def64c72dae45f3e4c8516e2111f2", body={}, ) as response: assert not response.is_closed @@ -61,16 +61,16 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.addressing.address_maps.zones.with_raw_response.update( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", zone_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.addressing.address_maps.zones.with_raw_response.update( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + zone_id="8ac8489932db6327334c9b6d58544cfe", account_id="", body={}, ) @@ -78,26 +78,26 @@ def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): client.addressing.address_maps.zones.with_raw_response.update( address_map_id="", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="8ac8489932db6327334c9b6d58544cfe", + account_id="258def64c72dae45f3e4c8516e2111f2", body={}, ) @parametrize def test_method_delete(self, client: Cloudflare) -> None: zone = client.addressing.address_maps.zones.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + zone_id="8ac8489932db6327334c9b6d58544cfe", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(ZoneDeleteResponse, zone, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.addressing.address_maps.zones.with_raw_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + zone_id="8ac8489932db6327334c9b6d58544cfe", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -108,9 +108,9 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.addressing.address_maps.zones.with_streaming_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + zone_id="8ac8489932db6327334c9b6d58544cfe", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -124,23 +124,23 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: def test_path_params_delete(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.addressing.address_maps.zones.with_raw_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", zone_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.addressing.address_maps.zones.with_raw_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + zone_id="8ac8489932db6327334c9b6d58544cfe", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): client.addressing.address_maps.zones.with_raw_response.delete( address_map_id="", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="8ac8489932db6327334c9b6d58544cfe", + account_id="258def64c72dae45f3e4c8516e2111f2", ) @@ -150,9 +150,9 @@ class TestAsyncZones: @parametrize async def test_method_update(self, async_client: AsyncCloudflare) -> None: zone = await async_client.addressing.address_maps.zones.update( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + zone_id="8ac8489932db6327334c9b6d58544cfe", + account_id="258def64c72dae45f3e4c8516e2111f2", body={}, ) assert_matches_type(ZoneUpdateResponse, zone, path=["response"]) @@ -160,9 +160,9 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.address_maps.zones.with_raw_response.update( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + zone_id="8ac8489932db6327334c9b6d58544cfe", + account_id="258def64c72dae45f3e4c8516e2111f2", body={}, ) @@ -174,9 +174,9 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.address_maps.zones.with_streaming_response.update( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + zone_id="8ac8489932db6327334c9b6d58544cfe", + account_id="258def64c72dae45f3e4c8516e2111f2", body={}, ) as response: assert not response.is_closed @@ -191,16 +191,16 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.addressing.address_maps.zones.with_raw_response.update( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", zone_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.addressing.address_maps.zones.with_raw_response.update( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + zone_id="8ac8489932db6327334c9b6d58544cfe", account_id="", body={}, ) @@ -208,26 +208,26 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): await async_client.addressing.address_maps.zones.with_raw_response.update( address_map_id="", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="8ac8489932db6327334c9b6d58544cfe", + account_id="258def64c72dae45f3e4c8516e2111f2", body={}, ) @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: zone = await async_client.addressing.address_maps.zones.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + zone_id="8ac8489932db6327334c9b6d58544cfe", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(ZoneDeleteResponse, zone, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.address_maps.zones.with_raw_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + zone_id="8ac8489932db6327334c9b6d58544cfe", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -238,9 +238,9 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.address_maps.zones.with_streaming_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + zone_id="8ac8489932db6327334c9b6d58544cfe", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -254,21 +254,21 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.addressing.address_maps.zones.with_raw_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", zone_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.addressing.address_maps.zones.with_raw_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + zone_id="8ac8489932db6327334c9b6d58544cfe", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): await async_client.addressing.address_maps.zones.with_raw_response.delete( address_map_id="", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="8ac8489932db6327334c9b6d58544cfe", + account_id="258def64c72dae45f3e4c8516e2111f2", ) diff --git a/tests/api_resources/addressing/loa_documents/test_downloads.py b/tests/api_resources/addressing/loa_documents/test_downloads.py deleted file mode 100644 index b4ff36279c0..00000000000 --- a/tests/api_resources/addressing/loa_documents/test_downloads.py +++ /dev/null @@ -1,184 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import httpx -import pytest -from respx import MockRouter - -from cloudflare import Cloudflare, AsyncCloudflare -from cloudflare._response import ( - BinaryAPIResponse, - AsyncBinaryAPIResponse, - StreamedBinaryAPIResponse, - AsyncStreamedBinaryAPIResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestDownloads: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip( - reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" - ) - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_method_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get( - "/accounts/023e105f4ecef8ad9ca31a8372d0c353/addressing/loa_documents/d933b1530bc56c9953cf8ce166da8004/download" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - download = client.addressing.loa_documents.downloads.get( - loa_document_id="d933b1530bc56c9953cf8ce166da8004", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert download.is_closed - assert download.json() == {"foo": "bar"} - assert cast(Any, download.is_closed) is True - assert isinstance(download, BinaryAPIResponse) - - @pytest.mark.skip( - reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" - ) - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_raw_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get( - "/accounts/023e105f4ecef8ad9ca31a8372d0c353/addressing/loa_documents/d933b1530bc56c9953cf8ce166da8004/download" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - - download = client.addressing.loa_documents.downloads.with_raw_response.get( - loa_document_id="d933b1530bc56c9953cf8ce166da8004", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert download.is_closed is True - assert download.http_request.headers.get("X-Stainless-Lang") == "python" - assert download.json() == {"foo": "bar"} - assert isinstance(download, BinaryAPIResponse) - - @pytest.mark.skip( - reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" - ) - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_streaming_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get( - "/accounts/023e105f4ecef8ad9ca31a8372d0c353/addressing/loa_documents/d933b1530bc56c9953cf8ce166da8004/download" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - with client.addressing.loa_documents.downloads.with_streaming_response.get( - loa_document_id="d933b1530bc56c9953cf8ce166da8004", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as download: - assert not download.is_closed - assert download.http_request.headers.get("X-Stainless-Lang") == "python" - - assert download.json() == {"foo": "bar"} - assert cast(Any, download.is_closed) is True - assert isinstance(download, StreamedBinaryAPIResponse) - - assert cast(Any, download.is_closed) is True - - @pytest.mark.skip( - reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" - ) - @parametrize - @pytest.mark.respx(base_url=base_url) - 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.addressing.loa_documents.downloads.with_raw_response.get( - loa_document_id="d933b1530bc56c9953cf8ce166da8004", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `loa_document_id` but received ''"): - client.addressing.loa_documents.downloads.with_raw_response.get( - loa_document_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncDownloads: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip( - reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" - ) - @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_method_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: - respx_mock.get( - "/accounts/023e105f4ecef8ad9ca31a8372d0c353/addressing/loa_documents/d933b1530bc56c9953cf8ce166da8004/download" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - download = await async_client.addressing.loa_documents.downloads.get( - loa_document_id="d933b1530bc56c9953cf8ce166da8004", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert download.is_closed - assert await download.json() == {"foo": "bar"} - assert cast(Any, download.is_closed) is True - assert isinstance(download, AsyncBinaryAPIResponse) - - @pytest.mark.skip( - reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" - ) - @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_raw_response_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: - respx_mock.get( - "/accounts/023e105f4ecef8ad9ca31a8372d0c353/addressing/loa_documents/d933b1530bc56c9953cf8ce166da8004/download" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - - download = await async_client.addressing.loa_documents.downloads.with_raw_response.get( - loa_document_id="d933b1530bc56c9953cf8ce166da8004", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert download.is_closed is True - assert download.http_request.headers.get("X-Stainless-Lang") == "python" - assert await download.json() == {"foo": "bar"} - assert isinstance(download, AsyncBinaryAPIResponse) - - @pytest.mark.skip( - reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" - ) - @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_streaming_response_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: - respx_mock.get( - "/accounts/023e105f4ecef8ad9ca31a8372d0c353/addressing/loa_documents/d933b1530bc56c9953cf8ce166da8004/download" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - async with async_client.addressing.loa_documents.downloads.with_streaming_response.get( - loa_document_id="d933b1530bc56c9953cf8ce166da8004", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as download: - assert not download.is_closed - assert download.http_request.headers.get("X-Stainless-Lang") == "python" - - assert await download.json() == {"foo": "bar"} - assert cast(Any, download.is_closed) is True - assert isinstance(download, AsyncStreamedBinaryAPIResponse) - - assert cast(Any, download.is_closed) is True - - @pytest.mark.skip( - reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" - ) - @parametrize - @pytest.mark.respx(base_url=base_url) - 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.addressing.loa_documents.downloads.with_raw_response.get( - loa_document_id="d933b1530bc56c9953cf8ce166da8004", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `loa_document_id` but received ''"): - await async_client.addressing.loa_documents.downloads.with_raw_response.get( - loa_document_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/addressing/prefixes/bgp/test_bindings.py b/tests/api_resources/addressing/prefixes/bgp/test_bindings.py deleted file mode 100644 index 1fca628ca73..00000000000 --- a/tests/api_resources/addressing/prefixes/bgp/test_bindings.py +++ /dev/null @@ -1,475 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.addressing.prefixes.bgp import ServiceBinding, BindingDeleteResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestBindings: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - binding = client.addressing.prefixes.bgp.bindings.create( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Cloudflare) -> None: - binding = client.addressing.prefixes.bgp.bindings.create( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - cidr="192.0.2.0/24", - service_id="2db684ee7ca04e159946fd05b99e1bcd", - ) - assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.addressing.prefixes.bgp.bindings.with_raw_response.create( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - binding = response.parse() - assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.addressing.prefixes.bgp.bindings.with_streaming_response.create( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - binding = response.parse() - assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.addressing.prefixes.bgp.bindings.with_raw_response.create( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): - client.addressing.prefixes.bgp.bindings.with_raw_response.create( - prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - binding = client.addressing.prefixes.bgp.bindings.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SyncSinglePage[ServiceBinding], binding, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.addressing.prefixes.bgp.bindings.with_raw_response.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - binding = response.parse() - assert_matches_type(SyncSinglePage[ServiceBinding], binding, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.addressing.prefixes.bgp.bindings.with_streaming_response.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - binding = response.parse() - assert_matches_type(SyncSinglePage[ServiceBinding], binding, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.addressing.prefixes.bgp.bindings.with_raw_response.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): - client.addressing.prefixes.bgp.bindings.with_raw_response.list( - prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - binding = client.addressing.prefixes.bgp.bindings.delete( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(BindingDeleteResponse, binding, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.addressing.prefixes.bgp.bindings.with_raw_response.delete( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - binding = response.parse() - assert_matches_type(BindingDeleteResponse, binding, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.addressing.prefixes.bgp.bindings.with_streaming_response.delete( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - binding = response.parse() - assert_matches_type(BindingDeleteResponse, binding, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.addressing.prefixes.bgp.bindings.with_raw_response.delete( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): - client.addressing.prefixes.bgp.bindings.with_raw_response.delete( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `binding_id` but received ''"): - client.addressing.prefixes.bgp.bindings.with_raw_response.delete( - binding_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - binding = client.addressing.prefixes.bgp.bindings.get( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.addressing.prefixes.bgp.bindings.with_raw_response.get( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - binding = response.parse() - assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.addressing.prefixes.bgp.bindings.with_streaming_response.get( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - binding = response.parse() - assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.addressing.prefixes.bgp.bindings.with_raw_response.get( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): - client.addressing.prefixes.bgp.bindings.with_raw_response.get( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `binding_id` but received ''"): - client.addressing.prefixes.bgp.bindings.with_raw_response.get( - binding_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncBindings: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: - binding = await async_client.addressing.prefixes.bgp.bindings.create( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - binding = await async_client.addressing.prefixes.bgp.bindings.create( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - cidr="192.0.2.0/24", - service_id="2db684ee7ca04e159946fd05b99e1bcd", - ) - assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.addressing.prefixes.bgp.bindings.with_raw_response.create( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - binding = await response.parse() - assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.addressing.prefixes.bgp.bindings.with_streaming_response.create( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - binding = await response.parse() - assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.addressing.prefixes.bgp.bindings.with_raw_response.create( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): - await async_client.addressing.prefixes.bgp.bindings.with_raw_response.create( - prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - binding = await async_client.addressing.prefixes.bgp.bindings.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(AsyncSinglePage[ServiceBinding], binding, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.addressing.prefixes.bgp.bindings.with_raw_response.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - binding = await response.parse() - assert_matches_type(AsyncSinglePage[ServiceBinding], binding, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.addressing.prefixes.bgp.bindings.with_streaming_response.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - binding = await response.parse() - assert_matches_type(AsyncSinglePage[ServiceBinding], binding, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.addressing.prefixes.bgp.bindings.with_raw_response.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): - await async_client.addressing.prefixes.bgp.bindings.with_raw_response.list( - prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - binding = await async_client.addressing.prefixes.bgp.bindings.delete( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(BindingDeleteResponse, binding, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.addressing.prefixes.bgp.bindings.with_raw_response.delete( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - binding = await response.parse() - assert_matches_type(BindingDeleteResponse, binding, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.addressing.prefixes.bgp.bindings.with_streaming_response.delete( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - binding = await response.parse() - assert_matches_type(BindingDeleteResponse, binding, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.addressing.prefixes.bgp.bindings.with_raw_response.delete( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): - await async_client.addressing.prefixes.bgp.bindings.with_raw_response.delete( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `binding_id` but received ''"): - await async_client.addressing.prefixes.bgp.bindings.with_raw_response.delete( - binding_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - binding = await async_client.addressing.prefixes.bgp.bindings.get( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.addressing.prefixes.bgp.bindings.with_raw_response.get( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - binding = await response.parse() - assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.addressing.prefixes.bgp.bindings.with_streaming_response.get( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - binding = await response.parse() - assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.addressing.prefixes.bgp.bindings.with_raw_response.get( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): - await async_client.addressing.prefixes.bgp.bindings.with_raw_response.get( - binding_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `binding_id` but received ''"): - await async_client.addressing.prefixes.bgp.bindings.with_raw_response.get( - binding_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/addressing/prefixes/bgp/test_prefixes.py b/tests/api_resources/addressing/prefixes/bgp/test_prefixes.py deleted file mode 100644 index c0486fa677a..00000000000 --- a/tests/api_resources/addressing/prefixes/bgp/test_prefixes.py +++ /dev/null @@ -1,379 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.addressing.prefixes.bgp import BGPPrefix - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestPrefixes: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - prefix = client.addressing.prefixes.bgp.prefixes.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SyncSinglePage[BGPPrefix], prefix, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.addressing.prefixes.bgp.prefixes.with_raw_response.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - prefix = response.parse() - assert_matches_type(SyncSinglePage[BGPPrefix], prefix, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.addressing.prefixes.bgp.prefixes.with_streaming_response.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - prefix = response.parse() - assert_matches_type(SyncSinglePage[BGPPrefix], prefix, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.addressing.prefixes.bgp.prefixes.with_raw_response.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): - client.addressing.prefixes.bgp.prefixes.with_raw_response.list( - prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - prefix = client.addressing.prefixes.bgp.prefixes.edit( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) - - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - prefix = client.addressing.prefixes.bgp.prefixes.edit( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - on_demand={"advertised": True}, - ) - assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.addressing.prefixes.bgp.prefixes.with_raw_response.edit( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - prefix = response.parse() - assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.addressing.prefixes.bgp.prefixes.with_streaming_response.edit( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - prefix = response.parse() - assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.addressing.prefixes.bgp.prefixes.with_raw_response.edit( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): - client.addressing.prefixes.bgp.prefixes.with_raw_response.edit( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bgp_prefix_id` but received ''"): - client.addressing.prefixes.bgp.prefixes.with_raw_response.edit( - bgp_prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - prefix = client.addressing.prefixes.bgp.prefixes.get( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.addressing.prefixes.bgp.prefixes.with_raw_response.get( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - prefix = response.parse() - assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.addressing.prefixes.bgp.prefixes.with_streaming_response.get( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - prefix = response.parse() - assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.addressing.prefixes.bgp.prefixes.with_raw_response.get( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): - client.addressing.prefixes.bgp.prefixes.with_raw_response.get( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bgp_prefix_id` but received ''"): - client.addressing.prefixes.bgp.prefixes.with_raw_response.get( - bgp_prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncPrefixes: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - prefix = await async_client.addressing.prefixes.bgp.prefixes.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(AsyncSinglePage[BGPPrefix], prefix, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.addressing.prefixes.bgp.prefixes.with_raw_response.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - prefix = await response.parse() - assert_matches_type(AsyncSinglePage[BGPPrefix], prefix, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.addressing.prefixes.bgp.prefixes.with_streaming_response.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - prefix = await response.parse() - assert_matches_type(AsyncSinglePage[BGPPrefix], prefix, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.addressing.prefixes.bgp.prefixes.with_raw_response.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): - await async_client.addressing.prefixes.bgp.prefixes.with_raw_response.list( - prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - prefix = await async_client.addressing.prefixes.bgp.prefixes.edit( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) - - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - prefix = await async_client.addressing.prefixes.bgp.prefixes.edit( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - on_demand={"advertised": True}, - ) - assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.addressing.prefixes.bgp.prefixes.with_raw_response.edit( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - prefix = await response.parse() - assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.addressing.prefixes.bgp.prefixes.with_streaming_response.edit( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - prefix = await response.parse() - assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.addressing.prefixes.bgp.prefixes.with_raw_response.edit( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): - await async_client.addressing.prefixes.bgp.prefixes.with_raw_response.edit( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bgp_prefix_id` but received ''"): - await async_client.addressing.prefixes.bgp.prefixes.with_raw_response.edit( - bgp_prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - prefix = await async_client.addressing.prefixes.bgp.prefixes.get( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.addressing.prefixes.bgp.prefixes.with_raw_response.get( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - prefix = await response.parse() - assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.addressing.prefixes.bgp.prefixes.with_streaming_response.get( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - prefix = await response.parse() - assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.addressing.prefixes.bgp.prefixes.with_raw_response.get( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): - await async_client.addressing.prefixes.bgp.prefixes.with_raw_response.get( - bgp_prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bgp_prefix_id` but received ''"): - await async_client.addressing.prefixes.bgp.prefixes.with_raw_response.get( - bgp_prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/addressing/prefixes/bgp/test_statuses.py b/tests/api_resources/addressing/prefixes/bgp/test_statuses.py deleted file mode 100644 index 3a1bf7f4e57..00000000000 --- a/tests/api_resources/addressing/prefixes/bgp/test_statuses.py +++ /dev/null @@ -1,224 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.addressing.prefixes.bgp import StatusGetResponse, StatusEditResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestStatuses: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - status = client.addressing.prefixes.bgp.statuses.edit( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - advertised=True, - ) - assert_matches_type(Optional[StatusEditResponse], status, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.addressing.prefixes.bgp.statuses.with_raw_response.edit( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - advertised=True, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - status = response.parse() - assert_matches_type(Optional[StatusEditResponse], status, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.addressing.prefixes.bgp.statuses.with_streaming_response.edit( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - advertised=True, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - status = response.parse() - assert_matches_type(Optional[StatusEditResponse], status, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.addressing.prefixes.bgp.statuses.with_raw_response.edit( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="", - advertised=True, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): - client.addressing.prefixes.bgp.statuses.with_raw_response.edit( - prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - advertised=True, - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - status = client.addressing.prefixes.bgp.statuses.get( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[StatusGetResponse], status, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.addressing.prefixes.bgp.statuses.with_raw_response.get( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - status = response.parse() - assert_matches_type(Optional[StatusGetResponse], status, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.addressing.prefixes.bgp.statuses.with_streaming_response.get( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - status = response.parse() - assert_matches_type(Optional[StatusGetResponse], status, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.addressing.prefixes.bgp.statuses.with_raw_response.get( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): - client.addressing.prefixes.bgp.statuses.with_raw_response.get( - prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncStatuses: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - status = await async_client.addressing.prefixes.bgp.statuses.edit( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - advertised=True, - ) - assert_matches_type(Optional[StatusEditResponse], status, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.addressing.prefixes.bgp.statuses.with_raw_response.edit( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - advertised=True, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - status = await response.parse() - assert_matches_type(Optional[StatusEditResponse], status, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.addressing.prefixes.bgp.statuses.with_streaming_response.edit( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - advertised=True, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - status = await response.parse() - assert_matches_type(Optional[StatusEditResponse], status, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.addressing.prefixes.bgp.statuses.with_raw_response.edit( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="", - advertised=True, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): - await async_client.addressing.prefixes.bgp.statuses.with_raw_response.edit( - prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - advertised=True, - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - status = await async_client.addressing.prefixes.bgp.statuses.get( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[StatusGetResponse], status, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.addressing.prefixes.bgp.statuses.with_raw_response.get( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - status = await response.parse() - assert_matches_type(Optional[StatusGetResponse], status, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.addressing.prefixes.bgp.statuses.with_streaming_response.get( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - status = await response.parse() - assert_matches_type(Optional[StatusGetResponse], status, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.addressing.prefixes.bgp.statuses.with_raw_response.get( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): - await async_client.addressing.prefixes.bgp.statuses.with_raw_response.get( - prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/addressing/prefixes/test_advertisement_status.py b/tests/api_resources/addressing/prefixes/test_advertisement_status.py new file mode 100644 index 00000000000..49a7236d5d7 --- /dev/null +++ b/tests/api_resources/addressing/prefixes/test_advertisement_status.py @@ -0,0 +1,227 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, Optional, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.types.addressing.prefixes import ( + AdvertisementStatusGetResponse, + AdvertisementStatusEditResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAdvertisementStatus: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_edit(self, client: Cloudflare) -> None: + advertisement_status = client.addressing.prefixes.advertisement_status.edit( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + advertised=True, + ) + assert_matches_type(Optional[AdvertisementStatusEditResponse], advertisement_status, path=["response"]) + + @parametrize + def test_raw_response_edit(self, client: Cloudflare) -> None: + response = client.addressing.prefixes.advertisement_status.with_raw_response.edit( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + advertised=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + advertisement_status = response.parse() + assert_matches_type(Optional[AdvertisementStatusEditResponse], advertisement_status, path=["response"]) + + @parametrize + def test_streaming_response_edit(self, client: Cloudflare) -> None: + with client.addressing.prefixes.advertisement_status.with_streaming_response.edit( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + advertised=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + advertisement_status = response.parse() + assert_matches_type(Optional[AdvertisementStatusEditResponse], advertisement_status, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_edit(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.addressing.prefixes.advertisement_status.with_raw_response.edit( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="", + advertised=True, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + client.addressing.prefixes.advertisement_status.with_raw_response.edit( + prefix_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + advertised=True, + ) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + advertisement_status = client.addressing.prefixes.advertisement_status.get( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + assert_matches_type(Optional[AdvertisementStatusGetResponse], advertisement_status, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.addressing.prefixes.advertisement_status.with_raw_response.get( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + advertisement_status = response.parse() + assert_matches_type(Optional[AdvertisementStatusGetResponse], advertisement_status, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.addressing.prefixes.advertisement_status.with_streaming_response.get( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + advertisement_status = response.parse() + assert_matches_type(Optional[AdvertisementStatusGetResponse], advertisement_status, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.addressing.prefixes.advertisement_status.with_raw_response.get( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + client.addressing.prefixes.advertisement_status.with_raw_response.get( + prefix_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + +class TestAsyncAdvertisementStatus: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_edit(self, async_client: AsyncCloudflare) -> None: + advertisement_status = await async_client.addressing.prefixes.advertisement_status.edit( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + advertised=True, + ) + assert_matches_type(Optional[AdvertisementStatusEditResponse], advertisement_status, path=["response"]) + + @parametrize + async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: + response = await async_client.addressing.prefixes.advertisement_status.with_raw_response.edit( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + advertised=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + advertisement_status = await response.parse() + assert_matches_type(Optional[AdvertisementStatusEditResponse], advertisement_status, path=["response"]) + + @parametrize + async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: + async with async_client.addressing.prefixes.advertisement_status.with_streaming_response.edit( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + advertised=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + advertisement_status = await response.parse() + assert_matches_type(Optional[AdvertisementStatusEditResponse], advertisement_status, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.addressing.prefixes.advertisement_status.with_raw_response.edit( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="", + advertised=True, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + await async_client.addressing.prefixes.advertisement_status.with_raw_response.edit( + prefix_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + advertised=True, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + advertisement_status = await async_client.addressing.prefixes.advertisement_status.get( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + assert_matches_type(Optional[AdvertisementStatusGetResponse], advertisement_status, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.addressing.prefixes.advertisement_status.with_raw_response.get( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + advertisement_status = await response.parse() + assert_matches_type(Optional[AdvertisementStatusGetResponse], advertisement_status, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.addressing.prefixes.advertisement_status.with_streaming_response.get( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + advertisement_status = await response.parse() + assert_matches_type(Optional[AdvertisementStatusGetResponse], advertisement_status, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.addressing.prefixes.advertisement_status.with_raw_response.get( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + await async_client.addressing.prefixes.advertisement_status.with_raw_response.get( + prefix_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) diff --git a/tests/api_resources/addressing/prefixes/test_bgp_prefixes.py b/tests/api_resources/addressing/prefixes/test_bgp_prefixes.py new file mode 100644 index 00000000000..06fe971018a --- /dev/null +++ b/tests/api_resources/addressing/prefixes/test_bgp_prefixes.py @@ -0,0 +1,493 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, Optional, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.addressing.prefixes import BGPPrefix + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestBGPPrefixes: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + bgp_prefix = client.addressing.prefixes.bgp_prefixes.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + bgp_prefix = client.addressing.prefixes.bgp_prefixes.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + cidr="192.0.2.0/24", + ) + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.addressing.prefixes.bgp_prefixes.with_raw_response.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bgp_prefix = response.parse() + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.addressing.prefixes.bgp_prefixes.with_streaming_response.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bgp_prefix = response.parse() + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.addressing.prefixes.bgp_prefixes.with_raw_response.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + client.addressing.prefixes.bgp_prefixes.with_raw_response.create( + prefix_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + bgp_prefix = client.addressing.prefixes.bgp_prefixes.list( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + assert_matches_type(SyncSinglePage[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.addressing.prefixes.bgp_prefixes.with_raw_response.list( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bgp_prefix = response.parse() + assert_matches_type(SyncSinglePage[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.addressing.prefixes.bgp_prefixes.with_streaming_response.list( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bgp_prefix = response.parse() + assert_matches_type(SyncSinglePage[BGPPrefix], bgp_prefix, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.addressing.prefixes.bgp_prefixes.with_raw_response.list( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + client.addressing.prefixes.bgp_prefixes.with_raw_response.list( + prefix_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + @parametrize + def test_method_edit(self, client: Cloudflare) -> None: + bgp_prefix = client.addressing.prefixes.bgp_prefixes.edit( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + def test_method_edit_with_all_params(self, client: Cloudflare) -> None: + bgp_prefix = client.addressing.prefixes.bgp_prefixes.edit( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + on_demand={"advertised": True}, + ) + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + def test_raw_response_edit(self, client: Cloudflare) -> None: + response = client.addressing.prefixes.bgp_prefixes.with_raw_response.edit( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bgp_prefix = response.parse() + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + def test_streaming_response_edit(self, client: Cloudflare) -> None: + with client.addressing.prefixes.bgp_prefixes.with_streaming_response.edit( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bgp_prefix = response.parse() + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_edit(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.addressing.prefixes.bgp_prefixes.with_raw_response.edit( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + client.addressing.prefixes.bgp_prefixes.with_raw_response.edit( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bgp_prefix_id` but received ''"): + client.addressing.prefixes.bgp_prefixes.with_raw_response.edit( + bgp_prefix_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + bgp_prefix = client.addressing.prefixes.bgp_prefixes.get( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.addressing.prefixes.bgp_prefixes.with_raw_response.get( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bgp_prefix = response.parse() + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.addressing.prefixes.bgp_prefixes.with_streaming_response.get( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bgp_prefix = response.parse() + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.addressing.prefixes.bgp_prefixes.with_raw_response.get( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + client.addressing.prefixes.bgp_prefixes.with_raw_response.get( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bgp_prefix_id` but received ''"): + client.addressing.prefixes.bgp_prefixes.with_raw_response.get( + bgp_prefix_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + +class TestAsyncBGPPrefixes: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + bgp_prefix = await async_client.addressing.prefixes.bgp_prefixes.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + bgp_prefix = await async_client.addressing.prefixes.bgp_prefixes.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + cidr="192.0.2.0/24", + ) + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.addressing.prefixes.bgp_prefixes.with_raw_response.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bgp_prefix = await response.parse() + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.addressing.prefixes.bgp_prefixes.with_streaming_response.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bgp_prefix = await response.parse() + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.addressing.prefixes.bgp_prefixes.with_raw_response.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + await async_client.addressing.prefixes.bgp_prefixes.with_raw_response.create( + prefix_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + bgp_prefix = await async_client.addressing.prefixes.bgp_prefixes.list( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + assert_matches_type(AsyncSinglePage[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.addressing.prefixes.bgp_prefixes.with_raw_response.list( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bgp_prefix = await response.parse() + assert_matches_type(AsyncSinglePage[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.addressing.prefixes.bgp_prefixes.with_streaming_response.list( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bgp_prefix = await response.parse() + assert_matches_type(AsyncSinglePage[BGPPrefix], bgp_prefix, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.addressing.prefixes.bgp_prefixes.with_raw_response.list( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + await async_client.addressing.prefixes.bgp_prefixes.with_raw_response.list( + prefix_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + @parametrize + async def test_method_edit(self, async_client: AsyncCloudflare) -> None: + bgp_prefix = await async_client.addressing.prefixes.bgp_prefixes.edit( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: + bgp_prefix = await async_client.addressing.prefixes.bgp_prefixes.edit( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + on_demand={"advertised": True}, + ) + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: + response = await async_client.addressing.prefixes.bgp_prefixes.with_raw_response.edit( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bgp_prefix = await response.parse() + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: + async with async_client.addressing.prefixes.bgp_prefixes.with_streaming_response.edit( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bgp_prefix = await response.parse() + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.addressing.prefixes.bgp_prefixes.with_raw_response.edit( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + await async_client.addressing.prefixes.bgp_prefixes.with_raw_response.edit( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bgp_prefix_id` but received ''"): + await async_client.addressing.prefixes.bgp_prefixes.with_raw_response.edit( + bgp_prefix_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + bgp_prefix = await async_client.addressing.prefixes.bgp_prefixes.get( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.addressing.prefixes.bgp_prefixes.with_raw_response.get( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bgp_prefix = await response.parse() + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.addressing.prefixes.bgp_prefixes.with_streaming_response.get( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bgp_prefix = await response.parse() + assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.addressing.prefixes.bgp_prefixes.with_raw_response.get( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + await async_client.addressing.prefixes.bgp_prefixes.with_raw_response.get( + bgp_prefix_id="7009ba364c7a5760798ceb430e603b74", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bgp_prefix_id` but received ''"): + await async_client.addressing.prefixes.bgp_prefixes.with_raw_response.get( + bgp_prefix_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) diff --git a/tests/api_resources/addressing/prefixes/test_delegations.py b/tests/api_resources/addressing/prefixes/test_delegations.py index dd17a7ac44b..83ec07279cc 100644 --- a/tests/api_resources/addressing/prefixes/test_delegations.py +++ b/tests/api_resources/addressing/prefixes/test_delegations.py @@ -21,8 +21,8 @@ class TestDelegations: @parametrize def test_method_create(self, client: Cloudflare) -> None: delegation = client.addressing.prefixes.delegations.create( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", cidr="192.0.2.0/24", delegated_account_id="b1946ac92492d2347c6235b4d2611184", ) @@ -31,8 +31,8 @@ def test_method_create(self, client: Cloudflare) -> None: @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.addressing.prefixes.delegations.with_raw_response.create( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", cidr="192.0.2.0/24", delegated_account_id="b1946ac92492d2347c6235b4d2611184", ) @@ -45,8 +45,8 @@ def test_raw_response_create(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.addressing.prefixes.delegations.with_streaming_response.create( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", cidr="192.0.2.0/24", delegated_account_id="b1946ac92492d2347c6235b4d2611184", ) as response: @@ -62,7 +62,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: 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.addressing.prefixes.delegations.with_raw_response.create( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", account_id="", cidr="192.0.2.0/24", delegated_account_id="b1946ac92492d2347c6235b4d2611184", @@ -71,7 +71,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): client.addressing.prefixes.delegations.with_raw_response.create( prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", cidr="192.0.2.0/24", delegated_account_id="b1946ac92492d2347c6235b4d2611184", ) @@ -79,16 +79,16 @@ def test_path_params_create(self, client: Cloudflare) -> None: @parametrize def test_method_list(self, client: Cloudflare) -> None: delegation = client.addressing.prefixes.delegations.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(SyncSinglePage[Delegations], delegation, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.addressing.prefixes.delegations.with_raw_response.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -99,8 +99,8 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: with client.addressing.prefixes.delegations.with_streaming_response.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -114,22 +114,22 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: 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.addressing.prefixes.delegations.with_raw_response.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): client.addressing.prefixes.delegations.with_raw_response.list( prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) @parametrize def test_method_delete(self, client: Cloudflare) -> None: delegation = client.addressing.prefixes.delegations.delete( delegation_id="d933b1530bc56c9953cf8ce166da8004", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", ) assert_matches_type(Optional[DelegationDeleteResponse], delegation, path=["response"]) @@ -137,8 +137,8 @@ def test_method_delete(self, client: Cloudflare) -> None: def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.addressing.prefixes.delegations.with_raw_response.delete( delegation_id="d933b1530bc56c9953cf8ce166da8004", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", ) assert response.is_closed is True @@ -150,8 +150,8 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.addressing.prefixes.delegations.with_streaming_response.delete( delegation_id="d933b1530bc56c9953cf8ce166da8004", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -167,21 +167,21 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.addressing.prefixes.delegations.with_raw_response.delete( delegation_id="d933b1530bc56c9953cf8ce166da8004", account_id="", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): client.addressing.prefixes.delegations.with_raw_response.delete( delegation_id="d933b1530bc56c9953cf8ce166da8004", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", prefix_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `delegation_id` but received ''"): client.addressing.prefixes.delegations.with_raw_response.delete( delegation_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", ) @@ -191,8 +191,8 @@ class TestAsyncDelegations: @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: delegation = await async_client.addressing.prefixes.delegations.create( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", cidr="192.0.2.0/24", delegated_account_id="b1946ac92492d2347c6235b4d2611184", ) @@ -201,8 +201,8 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.prefixes.delegations.with_raw_response.create( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", cidr="192.0.2.0/24", delegated_account_id="b1946ac92492d2347c6235b4d2611184", ) @@ -215,8 +215,8 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.prefixes.delegations.with_streaming_response.create( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", cidr="192.0.2.0/24", delegated_account_id="b1946ac92492d2347c6235b4d2611184", ) as response: @@ -232,7 +232,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> 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.addressing.prefixes.delegations.with_raw_response.create( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", account_id="", cidr="192.0.2.0/24", delegated_account_id="b1946ac92492d2347c6235b4d2611184", @@ -241,7 +241,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): await async_client.addressing.prefixes.delegations.with_raw_response.create( prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", cidr="192.0.2.0/24", delegated_account_id="b1946ac92492d2347c6235b4d2611184", ) @@ -249,16 +249,16 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: delegation = await async_client.addressing.prefixes.delegations.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(AsyncSinglePage[Delegations], delegation, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.prefixes.delegations.with_raw_response.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -269,8 +269,8 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.prefixes.delegations.with_streaming_response.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -284,22 +284,22 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N 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.addressing.prefixes.delegations.with_raw_response.list( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): await async_client.addressing.prefixes.delegations.with_raw_response.list( prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: delegation = await async_client.addressing.prefixes.delegations.delete( delegation_id="d933b1530bc56c9953cf8ce166da8004", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", ) assert_matches_type(Optional[DelegationDeleteResponse], delegation, path=["response"]) @@ -307,8 +307,8 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.prefixes.delegations.with_raw_response.delete( delegation_id="d933b1530bc56c9953cf8ce166da8004", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", ) assert response.is_closed is True @@ -320,8 +320,8 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.prefixes.delegations.with_streaming_response.delete( delegation_id="d933b1530bc56c9953cf8ce166da8004", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -337,19 +337,19 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.addressing.prefixes.delegations.with_raw_response.delete( delegation_id="d933b1530bc56c9953cf8ce166da8004", account_id="", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): await async_client.addressing.prefixes.delegations.with_raw_response.delete( delegation_id="d933b1530bc56c9953cf8ce166da8004", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", prefix_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `delegation_id` but received ''"): await async_client.addressing.prefixes.delegations.with_raw_response.delete( delegation_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", ) diff --git a/tests/api_resources/addressing/prefixes/test_service_bindings.py b/tests/api_resources/addressing/prefixes/test_service_bindings.py new file mode 100644 index 00000000000..98156802f9c --- /dev/null +++ b/tests/api_resources/addressing/prefixes/test_service_bindings.py @@ -0,0 +1,478 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, Optional, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.addressing.prefixes import ( + ServiceBinding, + ServiceBindingDeleteResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestServiceBindings: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + service_binding = client.addressing.prefixes.service_bindings.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + assert_matches_type(Optional[ServiceBinding], service_binding, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + service_binding = client.addressing.prefixes.service_bindings.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + cidr="192.0.2.0/24", + service_id="2db684ee7ca04e159946fd05b99e1bcd", + ) + assert_matches_type(Optional[ServiceBinding], service_binding, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.addressing.prefixes.service_bindings.with_raw_response.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + service_binding = response.parse() + assert_matches_type(Optional[ServiceBinding], service_binding, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.addressing.prefixes.service_bindings.with_streaming_response.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + service_binding = response.parse() + assert_matches_type(Optional[ServiceBinding], service_binding, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.addressing.prefixes.service_bindings.with_raw_response.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + client.addressing.prefixes.service_bindings.with_raw_response.create( + prefix_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + service_binding = client.addressing.prefixes.service_bindings.list( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + assert_matches_type(SyncSinglePage[ServiceBinding], service_binding, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.addressing.prefixes.service_bindings.with_raw_response.list( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + service_binding = response.parse() + assert_matches_type(SyncSinglePage[ServiceBinding], service_binding, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.addressing.prefixes.service_bindings.with_streaming_response.list( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + service_binding = response.parse() + assert_matches_type(SyncSinglePage[ServiceBinding], service_binding, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.addressing.prefixes.service_bindings.with_raw_response.list( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + client.addressing.prefixes.service_bindings.with_raw_response.list( + prefix_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + @parametrize + def test_method_delete(self, client: Cloudflare) -> None: + service_binding = client.addressing.prefixes.service_bindings.delete( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + assert_matches_type(ServiceBindingDeleteResponse, service_binding, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Cloudflare) -> None: + response = client.addressing.prefixes.service_bindings.with_raw_response.delete( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + service_binding = response.parse() + assert_matches_type(ServiceBindingDeleteResponse, service_binding, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Cloudflare) -> None: + with client.addressing.prefixes.service_bindings.with_streaming_response.delete( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + service_binding = response.parse() + assert_matches_type(ServiceBindingDeleteResponse, service_binding, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.addressing.prefixes.service_bindings.with_raw_response.delete( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + client.addressing.prefixes.service_bindings.with_raw_response.delete( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `binding_id` but received ''"): + client.addressing.prefixes.service_bindings.with_raw_response.delete( + binding_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + service_binding = client.addressing.prefixes.service_bindings.get( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + assert_matches_type(Optional[ServiceBinding], service_binding, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.addressing.prefixes.service_bindings.with_raw_response.get( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + service_binding = response.parse() + assert_matches_type(Optional[ServiceBinding], service_binding, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.addressing.prefixes.service_bindings.with_streaming_response.get( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + service_binding = response.parse() + assert_matches_type(Optional[ServiceBinding], service_binding, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.addressing.prefixes.service_bindings.with_raw_response.get( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + client.addressing.prefixes.service_bindings.with_raw_response.get( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `binding_id` but received ''"): + client.addressing.prefixes.service_bindings.with_raw_response.get( + binding_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + +class TestAsyncServiceBindings: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + service_binding = await async_client.addressing.prefixes.service_bindings.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + assert_matches_type(Optional[ServiceBinding], service_binding, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + service_binding = await async_client.addressing.prefixes.service_bindings.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + cidr="192.0.2.0/24", + service_id="2db684ee7ca04e159946fd05b99e1bcd", + ) + assert_matches_type(Optional[ServiceBinding], service_binding, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.addressing.prefixes.service_bindings.with_raw_response.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + service_binding = await response.parse() + assert_matches_type(Optional[ServiceBinding], service_binding, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.addressing.prefixes.service_bindings.with_streaming_response.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + service_binding = await response.parse() + assert_matches_type(Optional[ServiceBinding], service_binding, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.addressing.prefixes.service_bindings.with_raw_response.create( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + await async_client.addressing.prefixes.service_bindings.with_raw_response.create( + prefix_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + service_binding = await async_client.addressing.prefixes.service_bindings.list( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + assert_matches_type(AsyncSinglePage[ServiceBinding], service_binding, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.addressing.prefixes.service_bindings.with_raw_response.list( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + service_binding = await response.parse() + assert_matches_type(AsyncSinglePage[ServiceBinding], service_binding, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.addressing.prefixes.service_bindings.with_streaming_response.list( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + service_binding = await response.parse() + assert_matches_type(AsyncSinglePage[ServiceBinding], service_binding, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.addressing.prefixes.service_bindings.with_raw_response.list( + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + await async_client.addressing.prefixes.service_bindings.with_raw_response.list( + prefix_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncCloudflare) -> None: + service_binding = await async_client.addressing.prefixes.service_bindings.delete( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + assert_matches_type(ServiceBindingDeleteResponse, service_binding, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: + response = await async_client.addressing.prefixes.service_bindings.with_raw_response.delete( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + service_binding = await response.parse() + assert_matches_type(ServiceBindingDeleteResponse, service_binding, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: + async with async_client.addressing.prefixes.service_bindings.with_streaming_response.delete( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + service_binding = await response.parse() + assert_matches_type(ServiceBindingDeleteResponse, service_binding, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.addressing.prefixes.service_bindings.with_raw_response.delete( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + await async_client.addressing.prefixes.service_bindings.with_raw_response.delete( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `binding_id` but received ''"): + await async_client.addressing.prefixes.service_bindings.with_raw_response.delete( + binding_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + service_binding = await async_client.addressing.prefixes.service_bindings.get( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + assert_matches_type(Optional[ServiceBinding], service_binding, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.addressing.prefixes.service_bindings.with_raw_response.get( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + service_binding = await response.parse() + assert_matches_type(Optional[ServiceBinding], service_binding, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.addressing.prefixes.service_bindings.with_streaming_response.get( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + service_binding = await response.parse() + assert_matches_type(Optional[ServiceBinding], service_binding, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.addressing.prefixes.service_bindings.with_raw_response.get( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): + await async_client.addressing.prefixes.service_bindings.with_raw_response.get( + binding_id="0429b49b6a5155297b78e75a44b09e14", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `binding_id` but received ''"): + await async_client.addressing.prefixes.service_bindings.with_raw_response.get( + binding_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + prefix_id="2af39739cc4e3b5910c918468bb89828", + ) diff --git a/tests/api_resources/addressing/test_address_maps.py b/tests/api_resources/addressing/test_address_maps.py index 217bc4bbe15..ed645091db9 100644 --- a/tests/api_resources/addressing/test_address_maps.py +++ b/tests/api_resources/addressing/test_address_maps.py @@ -26,14 +26,14 @@ class TestAddressMaps: @parametrize def test_method_create(self, client: Cloudflare) -> None: address_map = client.addressing.address_maps.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: address_map = client.addressing.address_maps.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", description="My Ecommerce zones", enabled=True, ips=["192.0.2.1"], @@ -49,7 +49,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.addressing.address_maps.with_raw_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -60,7 +60,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.addressing.address_maps.with_streaming_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -80,14 +80,14 @@ def test_path_params_create(self, client: Cloudflare) -> None: @parametrize def test_method_list(self, client: Cloudflare) -> None: address_map = client.addressing.address_maps.list( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(SyncSinglePage[AddressMap], address_map, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.addressing.address_maps.with_raw_response.list( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -98,7 +98,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: with client.addressing.address_maps.with_streaming_response.list( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -118,16 +118,16 @@ def test_path_params_list(self, client: Cloudflare) -> None: @parametrize def test_method_delete(self, client: Cloudflare) -> None: address_map = client.addressing.address_maps.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(AddressMapDeleteResponse, address_map, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.addressing.address_maps.with_raw_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -138,8 +138,8 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.addressing.address_maps.with_streaming_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -153,29 +153,29 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: 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.addressing.address_maps.with_raw_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): client.addressing.address_maps.with_raw_response.delete( address_map_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) @parametrize def test_method_edit(self, client: Cloudflare) -> None: address_map = client.addressing.address_maps.edit( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(Optional[AddressMap], address_map, path=["response"]) @parametrize def test_method_edit_with_all_params(self, client: Cloudflare) -> None: address_map = client.addressing.address_maps.edit( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", default_sni="*.example.com", description="My Ecommerce zones", enabled=True, @@ -185,8 +185,8 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: response = client.addressing.address_maps.with_raw_response.edit( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -197,8 +197,8 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: with client.addressing.address_maps.with_streaming_response.edit( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -212,29 +212,29 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: def test_path_params_edit(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.addressing.address_maps.with_raw_response.edit( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): client.addressing.address_maps.with_raw_response.edit( address_map_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) @parametrize def test_method_get(self, client: Cloudflare) -> None: address_map = client.addressing.address_maps.get( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(Optional[AddressMapGetResponse], address_map, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.addressing.address_maps.with_raw_response.get( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -245,8 +245,8 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.addressing.address_maps.with_streaming_response.get( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -260,14 +260,14 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: 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.addressing.address_maps.with_raw_response.get( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): client.addressing.address_maps.with_raw_response.get( address_map_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) @@ -277,14 +277,14 @@ class TestAsyncAddressMaps: @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: address_map = await async_client.addressing.address_maps.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: address_map = await async_client.addressing.address_maps.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", description="My Ecommerce zones", enabled=True, ips=["192.0.2.1"], @@ -300,7 +300,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.address_maps.with_raw_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -311,7 +311,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.address_maps.with_streaming_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -331,14 +331,14 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: address_map = await async_client.addressing.address_maps.list( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(AsyncSinglePage[AddressMap], address_map, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.address_maps.with_raw_response.list( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -349,7 +349,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.address_maps.with_streaming_response.list( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -369,16 +369,16 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: address_map = await async_client.addressing.address_maps.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(AddressMapDeleteResponse, address_map, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.address_maps.with_raw_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -389,8 +389,8 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.address_maps.with_streaming_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -404,29 +404,29 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> 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.addressing.address_maps.with_raw_response.delete( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): await async_client.addressing.address_maps.with_raw_response.delete( address_map_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) @parametrize async def test_method_edit(self, async_client: AsyncCloudflare) -> None: address_map = await async_client.addressing.address_maps.edit( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(Optional[AddressMap], address_map, path=["response"]) @parametrize async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: address_map = await async_client.addressing.address_maps.edit( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", default_sni="*.example.com", description="My Ecommerce zones", enabled=True, @@ -436,8 +436,8 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.address_maps.with_raw_response.edit( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -448,8 +448,8 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.address_maps.with_streaming_response.edit( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -463,29 +463,29 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.addressing.address_maps.with_raw_response.edit( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): await async_client.addressing.address_maps.with_raw_response.edit( address_map_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: address_map = await async_client.addressing.address_maps.get( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(Optional[AddressMapGetResponse], address_map, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.address_maps.with_raw_response.get( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -496,8 +496,8 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.address_maps.with_streaming_response.get( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -511,12 +511,12 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No 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.addressing.address_maps.with_raw_response.get( - address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + address_map_id="055817b111884e0227e1be16a0be6ee0", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): await async_client.addressing.address_maps.with_raw_response.get( address_map_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) diff --git a/tests/api_resources/addressing/test_loa_documents.py b/tests/api_resources/addressing/test_loa_documents.py index b3bc8c3e862..6cfbe04f072 100644 --- a/tests/api_resources/addressing/test_loa_documents.py +++ b/tests/api_resources/addressing/test_loa_documents.py @@ -5,10 +5,18 @@ import os from typing import Any, Optional, cast +import httpx import pytest +from respx import MockRouter from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare._response import ( + BinaryAPIResponse, + AsyncBinaryAPIResponse, + StreamedBinaryAPIResponse, + AsyncStreamedBinaryAPIResponse, +) from cloudflare.types.addressing import LOADocumentCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,7 +29,7 @@ class TestLOADocuments: @parametrize def test_method_create(self, client: Cloudflare) -> None: loa_document = client.addressing.loa_documents.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", loa_document="@document.pdf", ) assert_matches_type(Optional[LOADocumentCreateResponse], loa_document, path=["response"]) @@ -30,7 +38,7 @@ def test_method_create(self, client: Cloudflare) -> None: @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.addressing.loa_documents.with_raw_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", loa_document="@document.pdf", ) @@ -43,7 +51,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.addressing.loa_documents.with_streaming_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", loa_document="@document.pdf", ) as response: assert not response.is_closed @@ -63,6 +71,84 @@ def test_path_params_create(self, client: Cloudflare) -> None: loa_document="@document.pdf", ) + @pytest.mark.skip( + reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" + ) + @parametrize + @pytest.mark.respx(base_url=base_url) + def test_method_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/258def64c72dae45f3e4c8516e2111f2/addressing/loa_documents/d933b1530bc56c9953cf8ce166da8004/download" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + loa_document = client.addressing.loa_documents.get( + loa_document_id="d933b1530bc56c9953cf8ce166da8004", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + assert loa_document.is_closed + assert loa_document.json() == {"foo": "bar"} + assert cast(Any, loa_document.is_closed) is True + assert isinstance(loa_document, BinaryAPIResponse) + + @pytest.mark.skip( + reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" + ) + @parametrize + @pytest.mark.respx(base_url=base_url) + def test_raw_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/258def64c72dae45f3e4c8516e2111f2/addressing/loa_documents/d933b1530bc56c9953cf8ce166da8004/download" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + loa_document = client.addressing.loa_documents.with_raw_response.get( + loa_document_id="d933b1530bc56c9953cf8ce166da8004", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + assert loa_document.is_closed is True + assert loa_document.http_request.headers.get("X-Stainless-Lang") == "python" + assert loa_document.json() == {"foo": "bar"} + assert isinstance(loa_document, BinaryAPIResponse) + + @pytest.mark.skip( + reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" + ) + @parametrize + @pytest.mark.respx(base_url=base_url) + def test_streaming_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/258def64c72dae45f3e4c8516e2111f2/addressing/loa_documents/d933b1530bc56c9953cf8ce166da8004/download" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + with client.addressing.loa_documents.with_streaming_response.get( + loa_document_id="d933b1530bc56c9953cf8ce166da8004", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) as loa_document: + assert not loa_document.is_closed + assert loa_document.http_request.headers.get("X-Stainless-Lang") == "python" + + assert loa_document.json() == {"foo": "bar"} + assert cast(Any, loa_document.is_closed) is True + assert isinstance(loa_document, StreamedBinaryAPIResponse) + + assert cast(Any, loa_document.is_closed) is True + + @pytest.mark.skip( + reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" + ) + @parametrize + @pytest.mark.respx(base_url=base_url) + 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.addressing.loa_documents.with_raw_response.get( + loa_document_id="d933b1530bc56c9953cf8ce166da8004", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `loa_document_id` but received ''"): + client.addressing.loa_documents.with_raw_response.get( + loa_document_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + class TestAsyncLOADocuments: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @@ -71,7 +157,7 @@ class TestAsyncLOADocuments: @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: loa_document = await async_client.addressing.loa_documents.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", loa_document="@document.pdf", ) assert_matches_type(Optional[LOADocumentCreateResponse], loa_document, path=["response"]) @@ -80,7 +166,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.loa_documents.with_raw_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", loa_document="@document.pdf", ) @@ -93,7 +179,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.loa_documents.with_streaming_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", loa_document="@document.pdf", ) as response: assert not response.is_closed @@ -112,3 +198,81 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: account_id="", loa_document="@document.pdf", ) + + @pytest.mark.skip( + reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" + ) + @parametrize + @pytest.mark.respx(base_url=base_url) + async def test_method_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/258def64c72dae45f3e4c8516e2111f2/addressing/loa_documents/d933b1530bc56c9953cf8ce166da8004/download" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + loa_document = await async_client.addressing.loa_documents.get( + loa_document_id="d933b1530bc56c9953cf8ce166da8004", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + assert loa_document.is_closed + assert await loa_document.json() == {"foo": "bar"} + assert cast(Any, loa_document.is_closed) is True + assert isinstance(loa_document, AsyncBinaryAPIResponse) + + @pytest.mark.skip( + reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" + ) + @parametrize + @pytest.mark.respx(base_url=base_url) + async def test_raw_response_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/258def64c72dae45f3e4c8516e2111f2/addressing/loa_documents/d933b1530bc56c9953cf8ce166da8004/download" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + loa_document = await async_client.addressing.loa_documents.with_raw_response.get( + loa_document_id="d933b1530bc56c9953cf8ce166da8004", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) + + assert loa_document.is_closed is True + assert loa_document.http_request.headers.get("X-Stainless-Lang") == "python" + assert await loa_document.json() == {"foo": "bar"} + assert isinstance(loa_document, AsyncBinaryAPIResponse) + + @pytest.mark.skip( + reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" + ) + @parametrize + @pytest.mark.respx(base_url=base_url) + async def test_streaming_response_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/258def64c72dae45f3e4c8516e2111f2/addressing/loa_documents/d933b1530bc56c9953cf8ce166da8004/download" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + async with async_client.addressing.loa_documents.with_streaming_response.get( + loa_document_id="d933b1530bc56c9953cf8ce166da8004", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) as loa_document: + assert not loa_document.is_closed + assert loa_document.http_request.headers.get("X-Stainless-Lang") == "python" + + assert await loa_document.json() == {"foo": "bar"} + assert cast(Any, loa_document.is_closed) is True + assert isinstance(loa_document, AsyncStreamedBinaryAPIResponse) + + assert cast(Any, loa_document.is_closed) is True + + @pytest.mark.skip( + reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" + ) + @parametrize + @pytest.mark.respx(base_url=base_url) + 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.addressing.loa_documents.with_raw_response.get( + loa_document_id="d933b1530bc56c9953cf8ce166da8004", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `loa_document_id` but received ''"): + await async_client.addressing.loa_documents.with_raw_response.get( + loa_document_id="", + account_id="258def64c72dae45f3e4c8516e2111f2", + ) diff --git a/tests/api_resources/addressing/test_prefixes.py b/tests/api_resources/addressing/test_prefixes.py index bf75c6e7bd0..955b4eaa157 100644 --- a/tests/api_resources/addressing/test_prefixes.py +++ b/tests/api_resources/addressing/test_prefixes.py @@ -21,7 +21,7 @@ class TestPrefixes: @parametrize def test_method_create(self, client: Cloudflare) -> None: prefix = client.addressing.prefixes.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", asn=209242, cidr="192.0.2.0/24", loa_document_id="d933b1530bc56c9953cf8ce166da8004", @@ -31,7 +31,7 @@ def test_method_create(self, client: Cloudflare) -> None: @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.addressing.prefixes.with_raw_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", asn=209242, cidr="192.0.2.0/24", loa_document_id="d933b1530bc56c9953cf8ce166da8004", @@ -45,7 +45,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.addressing.prefixes.with_streaming_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", asn=209242, cidr="192.0.2.0/24", loa_document_id="d933b1530bc56c9953cf8ce166da8004", @@ -71,14 +71,14 @@ def test_path_params_create(self, client: Cloudflare) -> None: @parametrize def test_method_list(self, client: Cloudflare) -> None: prefix = client.addressing.prefixes.list( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(SyncSinglePage[Prefix], prefix, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.addressing.prefixes.with_raw_response.list( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -89,7 +89,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: with client.addressing.prefixes.with_streaming_response.list( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -109,16 +109,16 @@ def test_path_params_list(self, client: Cloudflare) -> None: @parametrize def test_method_delete(self, client: Cloudflare) -> None: prefix = client.addressing.prefixes.delete( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(PrefixDeleteResponse, prefix, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.addressing.prefixes.with_raw_response.delete( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -129,8 +129,8 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.addressing.prefixes.with_streaming_response.delete( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -144,21 +144,21 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: 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.addressing.prefixes.with_raw_response.delete( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): client.addressing.prefixes.with_raw_response.delete( prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) @parametrize def test_method_edit(self, client: Cloudflare) -> None: prefix = client.addressing.prefixes.edit( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", description="Internal test prefix", ) assert_matches_type(Optional[Prefix], prefix, path=["response"]) @@ -166,8 +166,8 @@ def test_method_edit(self, client: Cloudflare) -> None: @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: response = client.addressing.prefixes.with_raw_response.edit( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", description="Internal test prefix", ) @@ -179,8 +179,8 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: with client.addressing.prefixes.with_streaming_response.edit( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", description="Internal test prefix", ) as response: assert not response.is_closed @@ -195,7 +195,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: def test_path_params_edit(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.addressing.prefixes.with_raw_response.edit( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", account_id="", description="Internal test prefix", ) @@ -203,23 +203,23 @@ def test_path_params_edit(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): client.addressing.prefixes.with_raw_response.edit( prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", description="Internal test prefix", ) @parametrize def test_method_get(self, client: Cloudflare) -> None: prefix = client.addressing.prefixes.get( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(Optional[Prefix], prefix, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.addressing.prefixes.with_raw_response.get( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -230,8 +230,8 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.addressing.prefixes.with_streaming_response.get( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -245,14 +245,14 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: 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.addressing.prefixes.with_raw_response.get( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): client.addressing.prefixes.with_raw_response.get( prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) @@ -262,7 +262,7 @@ class TestAsyncPrefixes: @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: prefix = await async_client.addressing.prefixes.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", asn=209242, cidr="192.0.2.0/24", loa_document_id="d933b1530bc56c9953cf8ce166da8004", @@ -272,7 +272,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.prefixes.with_raw_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", asn=209242, cidr="192.0.2.0/24", loa_document_id="d933b1530bc56c9953cf8ce166da8004", @@ -286,7 +286,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.prefixes.with_streaming_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", asn=209242, cidr="192.0.2.0/24", loa_document_id="d933b1530bc56c9953cf8ce166da8004", @@ -312,14 +312,14 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: prefix = await async_client.addressing.prefixes.list( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(AsyncSinglePage[Prefix], prefix, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.prefixes.with_raw_response.list( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -330,7 +330,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.prefixes.with_streaming_response.list( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -350,16 +350,16 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: prefix = await async_client.addressing.prefixes.delete( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(PrefixDeleteResponse, prefix, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.prefixes.with_raw_response.delete( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -370,8 +370,8 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.prefixes.with_streaming_response.delete( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -385,21 +385,21 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> 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.addressing.prefixes.with_raw_response.delete( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): await async_client.addressing.prefixes.with_raw_response.delete( prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) @parametrize async def test_method_edit(self, async_client: AsyncCloudflare) -> None: prefix = await async_client.addressing.prefixes.edit( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", description="Internal test prefix", ) assert_matches_type(Optional[Prefix], prefix, path=["response"]) @@ -407,8 +407,8 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.prefixes.with_raw_response.edit( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", description="Internal test prefix", ) @@ -420,8 +420,8 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.prefixes.with_streaming_response.edit( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", description="Internal test prefix", ) as response: assert not response.is_closed @@ -436,7 +436,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.addressing.prefixes.with_raw_response.edit( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", account_id="", description="Internal test prefix", ) @@ -444,23 +444,23 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): await async_client.addressing.prefixes.with_raw_response.edit( prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", description="Internal test prefix", ) @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: prefix = await async_client.addressing.prefixes.get( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(Optional[Prefix], prefix, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.prefixes.with_raw_response.get( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -471,8 +471,8 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.prefixes.with_streaming_response.get( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -486,12 +486,12 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No 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.addressing.prefixes.with_raw_response.get( - prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + prefix_id="2af39739cc4e3b5910c918468bb89828", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): await async_client.addressing.prefixes.with_raw_response.get( prefix_id="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) diff --git a/tests/api_resources/addressing/test_services.py b/tests/api_resources/addressing/test_services.py index e54cb33ece0..8d51e635ff9 100644 --- a/tests/api_resources/addressing/test_services.py +++ b/tests/api_resources/addressing/test_services.py @@ -21,14 +21,14 @@ class TestServices: @parametrize def test_method_list(self, client: Cloudflare) -> None: service = client.addressing.services.list( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(SyncSinglePage[ServiceListResponse], service, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.addressing.services.with_raw_response.list( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -39,7 +39,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: with client.addressing.services.with_streaming_response.list( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -63,14 +63,14 @@ class TestAsyncServices: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: service = await async_client.addressing.services.list( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert_matches_type(AsyncSinglePage[ServiceListResponse], service, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.services.with_raw_response.list( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) assert response.is_closed is True @@ -81,7 +81,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: async with async_client.addressing.services.with_streaming_response.list( - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="258def64c72dae45f3e4c8516e2111f2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/addressing/prefixes/bgp/__init__.py b/tests/api_resources/ai/__init__.py similarity index 100% rename from tests/api_resources/addressing/prefixes/bgp/__init__.py rename to tests/api_resources/ai/__init__.py diff --git a/tests/api_resources/workers/ai/__init__.py b/tests/api_resources/ai/finetunes/__init__.py similarity index 100% rename from tests/api_resources/workers/ai/__init__.py rename to tests/api_resources/ai/finetunes/__init__.py diff --git a/tests/api_resources/ai/finetunes/test_assets.py b/tests/api_resources/ai/finetunes/test_assets.py new file mode 100644 index 00000000000..1a692800031 --- /dev/null +++ b/tests/api_resources/ai/finetunes/test_assets.py @@ -0,0 +1,138 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.types.ai.finetunes import AssetCreateResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAssets: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + asset = client.ai.finetunes.assets.create( + finetune_id="bc451aef-f723-4b26-a6b2-901afd2e7a8a", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AssetCreateResponse, asset, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + asset = client.ai.finetunes.assets.create( + finetune_id="bc451aef-f723-4b26-a6b2-901afd2e7a8a", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + file=b"raw file contents", + file_name="file_name", + ) + assert_matches_type(AssetCreateResponse, asset, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.ai.finetunes.assets.with_raw_response.create( + finetune_id="bc451aef-f723-4b26-a6b2-901afd2e7a8a", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + asset = response.parse() + assert_matches_type(AssetCreateResponse, asset, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.ai.finetunes.assets.with_streaming_response.create( + finetune_id="bc451aef-f723-4b26-a6b2-901afd2e7a8a", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + asset = response.parse() + assert_matches_type(AssetCreateResponse, asset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.ai.finetunes.assets.with_raw_response.create( + finetune_id="bc451aef-f723-4b26-a6b2-901afd2e7a8a", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `finetune_id` but received ''"): + client.ai.finetunes.assets.with_raw_response.create( + finetune_id="", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + +class TestAsyncAssets: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + asset = await async_client.ai.finetunes.assets.create( + finetune_id="bc451aef-f723-4b26-a6b2-901afd2e7a8a", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AssetCreateResponse, asset, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + asset = await async_client.ai.finetunes.assets.create( + finetune_id="bc451aef-f723-4b26-a6b2-901afd2e7a8a", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + file=b"raw file contents", + file_name="file_name", + ) + assert_matches_type(AssetCreateResponse, asset, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.ai.finetunes.assets.with_raw_response.create( + finetune_id="bc451aef-f723-4b26-a6b2-901afd2e7a8a", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + asset = await response.parse() + assert_matches_type(AssetCreateResponse, asset, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.ai.finetunes.assets.with_streaming_response.create( + finetune_id="bc451aef-f723-4b26-a6b2-901afd2e7a8a", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + asset = await response.parse() + assert_matches_type(AssetCreateResponse, asset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.ai.finetunes.assets.with_raw_response.create( + finetune_id="bc451aef-f723-4b26-a6b2-901afd2e7a8a", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `finetune_id` but received ''"): + await async_client.ai.finetunes.assets.with_raw_response.create( + finetune_id="", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/ai/finetunes/test_public.py b/tests/api_resources/ai/finetunes/test_public.py new file mode 100644 index 00000000000..cc5f2b658c4 --- /dev/null +++ b/tests/api_resources/ai/finetunes/test_public.py @@ -0,0 +1,119 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.ai.finetunes import PublicListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPublic: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + public = client.ai.finetunes.public.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[PublicListResponse], public, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + public = client.ai.finetunes.public.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + limit=0, + offset=0, + order_by="orderBy", + ) + assert_matches_type(SyncSinglePage[PublicListResponse], public, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.ai.finetunes.public.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + public = response.parse() + assert_matches_type(SyncSinglePage[PublicListResponse], public, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.ai.finetunes.public.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + public = response.parse() + assert_matches_type(SyncSinglePage[PublicListResponse], public, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.ai.finetunes.public.with_raw_response.list( + account_id="", + ) + + +class TestAsyncPublic: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + public = await async_client.ai.finetunes.public.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[PublicListResponse], public, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + public = await async_client.ai.finetunes.public.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + limit=0, + offset=0, + order_by="orderBy", + ) + assert_matches_type(AsyncSinglePage[PublicListResponse], public, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.ai.finetunes.public.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + public = await response.parse() + assert_matches_type(AsyncSinglePage[PublicListResponse], public, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.ai.finetunes.public.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + public = await response.parse() + assert_matches_type(AsyncSinglePage[PublicListResponse], public, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.ai.finetunes.public.with_raw_response.list( + account_id="", + ) diff --git a/tests/api_resources/workers/ai/models/__init__.py b/tests/api_resources/ai/models/__init__.py similarity index 100% rename from tests/api_resources/workers/ai/models/__init__.py rename to tests/api_resources/ai/models/__init__.py diff --git a/tests/api_resources/workers/ai/models/test_schema.py b/tests/api_resources/ai/models/test_schema.py similarity index 85% rename from tests/api_resources/workers/ai/models/test_schema.py rename to tests/api_resources/ai/models/test_schema.py index a815dc1f7c1..c2592b98979 100644 --- a/tests/api_resources/workers/ai/models/test_schema.py +++ b/tests/api_resources/ai/models/test_schema.py @@ -18,7 +18,7 @@ class TestSchema: @parametrize def test_method_get(self, client: Cloudflare) -> None: - schema = client.workers.ai.models.schema.get( + schema = client.ai.models.schema.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", model="model", ) @@ -26,7 +26,7 @@ def test_method_get(self, client: Cloudflare) -> None: @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.workers.ai.models.schema.with_raw_response.get( + response = client.ai.models.schema.with_raw_response.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", model="model", ) @@ -38,7 +38,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.workers.ai.models.schema.with_streaming_response.get( + with client.ai.models.schema.with_streaming_response.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", model="model", ) as response: @@ -53,7 +53,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @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.ai.models.schema.with_raw_response.get( + client.ai.models.schema.with_raw_response.get( account_id="", model="model", ) @@ -64,7 +64,7 @@ class TestAsyncSchema: @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: - schema = await async_client.workers.ai.models.schema.get( + schema = await async_client.ai.models.schema.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", model="model", ) @@ -72,7 +72,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.ai.models.schema.with_raw_response.get( + response = await async_client.ai.models.schema.with_raw_response.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", model="model", ) @@ -84,7 +84,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.ai.models.schema.with_streaming_response.get( + async with async_client.ai.models.schema.with_streaming_response.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", model="model", ) as response: @@ -99,7 +99,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @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.ai.models.schema.with_raw_response.get( + await async_client.ai.models.schema.with_raw_response.get( account_id="", model="model", ) diff --git a/tests/api_resources/ai/test_authors.py b/tests/api_resources/ai/test_authors.py new file mode 100644 index 00000000000..16cdb1d7750 --- /dev/null +++ b/tests/api_resources/ai/test_authors.py @@ -0,0 +1,98 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAuthors: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + author = client.ai.authors.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[object], author, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.ai.authors.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + author = response.parse() + assert_matches_type(SyncSinglePage[object], author, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.ai.authors.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + author = response.parse() + assert_matches_type(SyncSinglePage[object], author, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.ai.authors.with_raw_response.list( + account_id="", + ) + + +class TestAsyncAuthors: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + author = await async_client.ai.authors.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[object], author, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.ai.authors.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + author = await response.parse() + assert_matches_type(AsyncSinglePage[object], author, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.ai.authors.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + author = await response.parse() + assert_matches_type(AsyncSinglePage[object], author, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.ai.authors.with_raw_response.list( + account_id="", + ) diff --git a/tests/api_resources/ai/test_finetunes.py b/tests/api_resources/ai/test_finetunes.py new file mode 100644 index 00000000000..e01ec841666 --- /dev/null +++ b/tests/api_resources/ai/test_finetunes.py @@ -0,0 +1,212 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.types.ai import FinetuneListResponse, FinetuneCreateResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFinetunes: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + finetune = client.ai.finetunes.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + model="model", + name="name", + ) + assert_matches_type(FinetuneCreateResponse, finetune, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + finetune = client.ai.finetunes.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + model="model", + name="name", + description="description", + public=True, + ) + assert_matches_type(FinetuneCreateResponse, finetune, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.ai.finetunes.with_raw_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + model="model", + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + finetune = response.parse() + assert_matches_type(FinetuneCreateResponse, finetune, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.ai.finetunes.with_streaming_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + model="model", + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + finetune = response.parse() + assert_matches_type(FinetuneCreateResponse, finetune, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.ai.finetunes.with_raw_response.create( + account_id="", + model="model", + name="name", + ) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + finetune = client.ai.finetunes.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(FinetuneListResponse, finetune, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.ai.finetunes.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + finetune = response.parse() + assert_matches_type(FinetuneListResponse, finetune, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.ai.finetunes.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + finetune = response.parse() + assert_matches_type(FinetuneListResponse, finetune, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.ai.finetunes.with_raw_response.list( + account_id="", + ) + + +class TestAsyncFinetunes: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + finetune = await async_client.ai.finetunes.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + model="model", + name="name", + ) + assert_matches_type(FinetuneCreateResponse, finetune, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + finetune = await async_client.ai.finetunes.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + model="model", + name="name", + description="description", + public=True, + ) + assert_matches_type(FinetuneCreateResponse, finetune, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.ai.finetunes.with_raw_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + model="model", + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + finetune = await response.parse() + assert_matches_type(FinetuneCreateResponse, finetune, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.ai.finetunes.with_streaming_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + model="model", + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + finetune = await response.parse() + assert_matches_type(FinetuneCreateResponse, finetune, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.ai.finetunes.with_raw_response.create( + account_id="", + model="model", + name="name", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + finetune = await async_client.ai.finetunes.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(FinetuneListResponse, finetune, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.ai.finetunes.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + finetune = await response.parse() + assert_matches_type(FinetuneListResponse, finetune, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.ai.finetunes.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + finetune = await response.parse() + assert_matches_type(FinetuneListResponse, finetune, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.ai.finetunes.with_raw_response.list( + account_id="", + ) diff --git a/tests/api_resources/ai/test_models.py b/tests/api_resources/ai/test_models.py new file mode 100644 index 00000000000..56897b9a250 --- /dev/null +++ b/tests/api_resources/ai/test_models.py @@ -0,0 +1,126 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestModels: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + model = client.ai.models.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncV4PagePaginationArray[object], model, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + model = client.ai.models.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + author="author", + hide_experimental=True, + page=0, + per_page=0, + search="search", + source=0, + task="Text Generation", + ) + assert_matches_type(SyncV4PagePaginationArray[object], model, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.ai.models.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + model = response.parse() + assert_matches_type(SyncV4PagePaginationArray[object], model, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.ai.models.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + model = response.parse() + assert_matches_type(SyncV4PagePaginationArray[object], model, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.ai.models.with_raw_response.list( + account_id="", + ) + + +class TestAsyncModels: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + model = await async_client.ai.models.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncV4PagePaginationArray[object], model, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + model = await async_client.ai.models.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + author="author", + hide_experimental=True, + page=0, + per_page=0, + search="search", + source=0, + task="Text Generation", + ) + assert_matches_type(AsyncV4PagePaginationArray[object], model, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.ai.models.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + model = await response.parse() + assert_matches_type(AsyncV4PagePaginationArray[object], model, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.ai.models.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + model = await response.parse() + assert_matches_type(AsyncV4PagePaginationArray[object], model, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.ai.models.with_raw_response.list( + account_id="", + ) diff --git a/tests/api_resources/ai/test_tasks.py b/tests/api_resources/ai/test_tasks.py new file mode 100644 index 00000000000..4383e0af353 --- /dev/null +++ b/tests/api_resources/ai/test_tasks.py @@ -0,0 +1,98 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTasks: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + task = client.ai.tasks.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[object], task, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.ai.tasks.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = response.parse() + assert_matches_type(SyncSinglePage[object], task, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.ai.tasks.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = response.parse() + assert_matches_type(SyncSinglePage[object], task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.ai.tasks.with_raw_response.list( + account_id="", + ) + + +class TestAsyncTasks: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + task = await async_client.ai.tasks.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[object], task, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.ai.tasks.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = await response.parse() + assert_matches_type(AsyncSinglePage[object], task, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.ai.tasks.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = await response.parse() + assert_matches_type(AsyncSinglePage[object], task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.ai.tasks.with_raw_response.list( + account_id="", + ) diff --git a/tests/api_resources/ai_gateway/test_datasets.py b/tests/api_resources/ai_gateway/test_datasets.py index b89ce377825..dc7ab2a74c5 100644 --- a/tests/api_resources/ai_gateway/test_datasets.py +++ b/tests/api_resources/ai_gateway/test_datasets.py @@ -246,8 +246,6 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", enable=True, name="name", - order_by="order_by", - order_by_direction="asc", page=1, per_page=1, search="search", @@ -640,8 +638,6 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", enable=True, name="name", - order_by="order_by", - order_by_direction="asc", page=1, per_page=1, search="search", diff --git a/tests/api_resources/ai_gateway/test_evaluations.py b/tests/api_resources/ai_gateway/test_evaluations.py index 6d6566a3b2d..444549e3cef 100644 --- a/tests/api_resources/ai_gateway/test_evaluations.py +++ b/tests/api_resources/ai_gateway/test_evaluations.py @@ -100,8 +100,6 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: gateway_id="my-gateway", account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", name="name", - order_by="order_by", - order_by_direction="asc", page=1, per_page=1, processed=True, @@ -350,8 +348,6 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) gateway_id="my-gateway", account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", name="name", - order_by="order_by", - order_by_direction="asc", page=1, per_page=1, processed=True, diff --git a/tests/api_resources/ai_gateway/test_logs.py b/tests/api_resources/ai_gateway/test_logs.py index 44ff2500f24..4be76ce1282 100644 --- a/tests/api_resources/ai_gateway/test_logs.py +++ b/tests/api_resources/ai_gateway/test_logs.py @@ -42,7 +42,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: feedback=0, filters=[ { - "key": "created_at", + "key": "id", "operator": "eq", "value": ["string"], } @@ -128,7 +128,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: account_id="0d37909e38d3e99c29fa2cd343ac421a", filters=[ { - "key": "created_at", + "key": "id", "operator": "eq", "value": ["string"], } @@ -454,7 +454,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) feedback=0, filters=[ { - "key": "created_at", + "key": "id", "operator": "eq", "value": ["string"], } @@ -540,7 +540,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare account_id="0d37909e38d3e99c29fa2cd343ac421a", filters=[ { - "key": "created_at", + "key": "id", "operator": "eq", "value": ["string"], } diff --git a/tests/api_resources/api_gateway/test_operations.py b/tests/api_resources/api_gateway/test_operations.py index 2be09e57fa3..f61103adcc9 100644 --- a/tests/api_resources/api_gateway/test_operations.py +++ b/tests/api_resources/api_gateway/test_operations.py @@ -15,6 +15,7 @@ OperationListResponse, OperationCreateResponse, OperationDeleteResponse, + OperationBulkCreateResponse, OperationBulkDeleteResponse, ) @@ -28,13 +29,9 @@ class TestOperations: def test_method_create(self, client: Cloudflare) -> None: operation = client.api_gateway.operations.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "endpoint": "/api/v1/users/{var1}", - "host": "www.example.com", - "method": "GET", - } - ], + endpoint="/api/v1/users/{var1}", + host="www.example.com", + method="GET", ) assert_matches_type(OperationCreateResponse, operation, path=["response"]) @@ -42,13 +39,9 @@ def test_method_create(self, client: Cloudflare) -> None: def test_raw_response_create(self, client: Cloudflare) -> None: response = client.api_gateway.operations.with_raw_response.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "endpoint": "/api/v1/users/{var1}", - "host": "www.example.com", - "method": "GET", - } - ], + endpoint="/api/v1/users/{var1}", + host="www.example.com", + method="GET", ) assert response.is_closed is True @@ -60,13 +53,9 @@ def test_raw_response_create(self, client: Cloudflare) -> None: def test_streaming_response_create(self, client: Cloudflare) -> None: with client.api_gateway.operations.with_streaming_response.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "endpoint": "/api/v1/users/{var1}", - "host": "www.example.com", - "method": "GET", - } - ], + endpoint="/api/v1/users/{var1}", + host="www.example.com", + method="GET", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -81,13 +70,9 @@ def test_path_params_create(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.api_gateway.operations.with_raw_response.create( zone_id="", - body=[ - { - "endpoint": "/api/v1/users/{var1}", - "host": "www.example.com", - "method": "GET", - } - ], + endpoint="/api/v1/users/{var1}", + host="www.example.com", + method="GET", ) @parametrize @@ -191,6 +176,72 @@ def test_path_params_delete(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) + @parametrize + def test_method_bulk_create(self, client: Cloudflare) -> None: + operation = client.api_gateway.operations.bulk_create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body=[ + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + } + ], + ) + assert_matches_type(OperationBulkCreateResponse, operation, path=["response"]) + + @parametrize + def test_raw_response_bulk_create(self, client: Cloudflare) -> None: + response = client.api_gateway.operations.with_raw_response.bulk_create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body=[ + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + } + ], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + operation = response.parse() + assert_matches_type(OperationBulkCreateResponse, operation, path=["response"]) + + @parametrize + def test_streaming_response_bulk_create(self, client: Cloudflare) -> None: + with client.api_gateway.operations.with_streaming_response.bulk_create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body=[ + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + } + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + operation = response.parse() + assert_matches_type(OperationBulkCreateResponse, operation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_bulk_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.operations.with_raw_response.bulk_create( + zone_id="", + body=[ + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + } + ], + ) + @parametrize def test_method_bulk_delete(self, client: Cloudflare) -> None: operation = client.api_gateway.operations.bulk_delete( @@ -294,13 +345,9 @@ class TestAsyncOperations: async def test_method_create(self, async_client: AsyncCloudflare) -> None: operation = await async_client.api_gateway.operations.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "endpoint": "/api/v1/users/{var1}", - "host": "www.example.com", - "method": "GET", - } - ], + endpoint="/api/v1/users/{var1}", + host="www.example.com", + method="GET", ) assert_matches_type(OperationCreateResponse, operation, path=["response"]) @@ -308,13 +355,9 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.api_gateway.operations.with_raw_response.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "endpoint": "/api/v1/users/{var1}", - "host": "www.example.com", - "method": "GET", - } - ], + endpoint="/api/v1/users/{var1}", + host="www.example.com", + method="GET", ) assert response.is_closed is True @@ -326,13 +369,9 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.api_gateway.operations.with_streaming_response.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "endpoint": "/api/v1/users/{var1}", - "host": "www.example.com", - "method": "GET", - } - ], + endpoint="/api/v1/users/{var1}", + host="www.example.com", + method="GET", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -347,13 +386,9 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.api_gateway.operations.with_raw_response.create( zone_id="", - body=[ - { - "endpoint": "/api/v1/users/{var1}", - "host": "www.example.com", - "method": "GET", - } - ], + endpoint="/api/v1/users/{var1}", + host="www.example.com", + method="GET", ) @parametrize @@ -457,6 +492,72 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) + @parametrize + async def test_method_bulk_create(self, async_client: AsyncCloudflare) -> None: + operation = await async_client.api_gateway.operations.bulk_create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body=[ + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + } + ], + ) + assert_matches_type(OperationBulkCreateResponse, operation, path=["response"]) + + @parametrize + async def test_raw_response_bulk_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.operations.with_raw_response.bulk_create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body=[ + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + } + ], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + operation = await response.parse() + assert_matches_type(OperationBulkCreateResponse, operation, path=["response"]) + + @parametrize + async def test_streaming_response_bulk_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.operations.with_streaming_response.bulk_create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body=[ + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + } + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + operation = await response.parse() + assert_matches_type(OperationBulkCreateResponse, operation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_bulk_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.operations.with_raw_response.bulk_create( + zone_id="", + body=[ + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + } + ], + ) + @parametrize async def test_method_bulk_delete(self, async_client: AsyncCloudflare) -> None: operation = await async_client.api_gateway.operations.bulk_delete( diff --git a/tests/api_resources/argo/test_tiered_caching.py b/tests/api_resources/argo/test_tiered_caching.py index 9afbafa5d1c..d91060caa7b 100644 --- a/tests/api_resources/argo/test_tiered_caching.py +++ b/tests/api_resources/argo/test_tiered_caching.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -23,7 +23,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(TieredCachingEditResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingEditResponse], tiered_caching, path=["response"]) @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: @@ -35,7 +35,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tiered_caching = response.parse() - assert_matches_type(TieredCachingEditResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingEditResponse], tiered_caching, path=["response"]) @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: @@ -47,7 +47,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tiered_caching = response.parse() - assert_matches_type(TieredCachingEditResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingEditResponse], tiered_caching, path=["response"]) assert cast(Any, response.is_closed) is True @@ -64,7 +64,7 @@ def test_method_get(self, client: Cloudflare) -> None: tiered_caching = client.argo.tiered_caching.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TieredCachingGetResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingGetResponse], tiered_caching, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -75,7 +75,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tiered_caching = response.parse() - assert_matches_type(TieredCachingGetResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingGetResponse], tiered_caching, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -86,7 +86,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tiered_caching = response.parse() - assert_matches_type(TieredCachingGetResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingGetResponse], tiered_caching, path=["response"]) assert cast(Any, response.is_closed) is True @@ -107,7 +107,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(TieredCachingEditResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingEditResponse], tiered_caching, path=["response"]) @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -119,7 +119,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tiered_caching = await response.parse() - assert_matches_type(TieredCachingEditResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingEditResponse], tiered_caching, path=["response"]) @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -131,7 +131,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" tiered_caching = await response.parse() - assert_matches_type(TieredCachingEditResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingEditResponse], tiered_caching, path=["response"]) assert cast(Any, response.is_closed) is True @@ -148,7 +148,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: tiered_caching = await async_client.argo.tiered_caching.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TieredCachingGetResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingGetResponse], tiered_caching, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -159,7 +159,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tiered_caching = await response.parse() - assert_matches_type(TieredCachingGetResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingGetResponse], tiered_caching, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -170,7 +170,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" tiered_caching = await response.parse() - assert_matches_type(TieredCachingGetResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingGetResponse], tiered_caching, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cache/test_cache_reserve.py b/tests/api_resources/cache/test_cache_reserve.py index 1d1478215cf..1d125319b6f 100644 --- a/tests/api_resources/cache/test_cache_reserve.py +++ b/tests/api_resources/cache/test_cache_reserve.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -28,7 +28,7 @@ def test_method_clear(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(CacheReserveClearResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveClearResponse], cache_reserve, path=["response"]) @parametrize def test_raw_response_clear(self, client: Cloudflare) -> None: @@ -40,7 +40,7 @@ def test_raw_response_clear(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = response.parse() - assert_matches_type(CacheReserveClearResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveClearResponse], cache_reserve, path=["response"]) @parametrize def test_streaming_response_clear(self, client: Cloudflare) -> None: @@ -52,7 +52,7 @@ def test_streaming_response_clear(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = response.parse() - assert_matches_type(CacheReserveClearResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveClearResponse], cache_reserve, path=["response"]) assert cast(Any, response.is_closed) is True @@ -70,7 +70,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(CacheReserveEditResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveEditResponse], cache_reserve, path=["response"]) @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: @@ -82,7 +82,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = response.parse() - assert_matches_type(CacheReserveEditResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveEditResponse], cache_reserve, path=["response"]) @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: @@ -94,7 +94,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = response.parse() - assert_matches_type(CacheReserveEditResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveEditResponse], cache_reserve, path=["response"]) assert cast(Any, response.is_closed) is True @@ -111,7 +111,7 @@ def test_method_get(self, client: Cloudflare) -> None: cache_reserve = client.cache.cache_reserve.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CacheReserveGetResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveGetResponse], cache_reserve, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -122,7 +122,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = response.parse() - assert_matches_type(CacheReserveGetResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveGetResponse], cache_reserve, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -133,7 +133,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = response.parse() - assert_matches_type(CacheReserveGetResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveGetResponse], cache_reserve, path=["response"]) assert cast(Any, response.is_closed) is True @@ -149,7 +149,7 @@ def test_method_status(self, client: Cloudflare) -> None: cache_reserve = client.cache.cache_reserve.status( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CacheReserveStatusResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveStatusResponse], cache_reserve, path=["response"]) @parametrize def test_raw_response_status(self, client: Cloudflare) -> None: @@ -160,7 +160,7 @@ def test_raw_response_status(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = response.parse() - assert_matches_type(CacheReserveStatusResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveStatusResponse], cache_reserve, path=["response"]) @parametrize def test_streaming_response_status(self, client: Cloudflare) -> None: @@ -171,7 +171,7 @@ def test_streaming_response_status(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = response.parse() - assert_matches_type(CacheReserveStatusResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveStatusResponse], cache_reserve, path=["response"]) assert cast(Any, response.is_closed) is True @@ -192,7 +192,7 @@ async def test_method_clear(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(CacheReserveClearResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveClearResponse], cache_reserve, path=["response"]) @parametrize async def test_raw_response_clear(self, async_client: AsyncCloudflare) -> None: @@ -204,7 +204,7 @@ async def test_raw_response_clear(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = await response.parse() - assert_matches_type(CacheReserveClearResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveClearResponse], cache_reserve, path=["response"]) @parametrize async def test_streaming_response_clear(self, async_client: AsyncCloudflare) -> None: @@ -216,7 +216,7 @@ async def test_streaming_response_clear(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = await response.parse() - assert_matches_type(CacheReserveClearResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveClearResponse], cache_reserve, path=["response"]) assert cast(Any, response.is_closed) is True @@ -234,7 +234,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(CacheReserveEditResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveEditResponse], cache_reserve, path=["response"]) @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -246,7 +246,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = await response.parse() - assert_matches_type(CacheReserveEditResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveEditResponse], cache_reserve, path=["response"]) @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -258,7 +258,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = await response.parse() - assert_matches_type(CacheReserveEditResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveEditResponse], cache_reserve, path=["response"]) assert cast(Any, response.is_closed) is True @@ -275,7 +275,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: cache_reserve = await async_client.cache.cache_reserve.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CacheReserveGetResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveGetResponse], cache_reserve, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -286,7 +286,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = await response.parse() - assert_matches_type(CacheReserveGetResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveGetResponse], cache_reserve, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -297,7 +297,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = await response.parse() - assert_matches_type(CacheReserveGetResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveGetResponse], cache_reserve, path=["response"]) assert cast(Any, response.is_closed) is True @@ -313,7 +313,7 @@ async def test_method_status(self, async_client: AsyncCloudflare) -> None: cache_reserve = await async_client.cache.cache_reserve.status( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CacheReserveStatusResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveStatusResponse], cache_reserve, path=["response"]) @parametrize async def test_raw_response_status(self, async_client: AsyncCloudflare) -> None: @@ -324,7 +324,7 @@ async def test_raw_response_status(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = await response.parse() - assert_matches_type(CacheReserveStatusResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveStatusResponse], cache_reserve, path=["response"]) @parametrize async def test_streaming_response_status(self, async_client: AsyncCloudflare) -> None: @@ -335,7 +335,7 @@ async def test_streaming_response_status(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = await response.parse() - assert_matches_type(CacheReserveStatusResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveStatusResponse], cache_reserve, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cache/test_regional_tiered_cache.py b/tests/api_resources/cache/test_regional_tiered_cache.py index ec3ddfeb861..98deff2adf5 100644 --- a/tests/api_resources/cache/test_regional_tiered_cache.py +++ b/tests/api_resources/cache/test_regional_tiered_cache.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -26,7 +26,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(RegionalTieredCacheEditResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheEditResponse], regional_tiered_cache, path=["response"]) @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: @@ -38,7 +38,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" regional_tiered_cache = response.parse() - assert_matches_type(RegionalTieredCacheEditResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheEditResponse], regional_tiered_cache, path=["response"]) @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" regional_tiered_cache = response.parse() - assert_matches_type(RegionalTieredCacheEditResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheEditResponse], regional_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True @@ -67,7 +67,7 @@ def test_method_get(self, client: Cloudflare) -> None: regional_tiered_cache = client.cache.regional_tiered_cache.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RegionalTieredCacheGetResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheGetResponse], regional_tiered_cache, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -78,7 +78,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" regional_tiered_cache = response.parse() - assert_matches_type(RegionalTieredCacheGetResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheGetResponse], regional_tiered_cache, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -89,7 +89,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" regional_tiered_cache = response.parse() - assert_matches_type(RegionalTieredCacheGetResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheGetResponse], regional_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True @@ -110,7 +110,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(RegionalTieredCacheEditResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheEditResponse], regional_tiered_cache, path=["response"]) @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -122,7 +122,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" regional_tiered_cache = await response.parse() - assert_matches_type(RegionalTieredCacheEditResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheEditResponse], regional_tiered_cache, path=["response"]) @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -134,7 +134,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" regional_tiered_cache = await response.parse() - assert_matches_type(RegionalTieredCacheEditResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheEditResponse], regional_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True @@ -151,7 +151,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: regional_tiered_cache = await async_client.cache.regional_tiered_cache.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RegionalTieredCacheGetResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheGetResponse], regional_tiered_cache, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -162,7 +162,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" regional_tiered_cache = await response.parse() - assert_matches_type(RegionalTieredCacheGetResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheGetResponse], regional_tiered_cache, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -173,7 +173,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" regional_tiered_cache = await response.parse() - assert_matches_type(RegionalTieredCacheGetResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheGetResponse], regional_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cache/test_smart_tiered_cache.py b/tests/api_resources/cache/test_smart_tiered_cache.py index b683f9fc4dc..4502fff107d 100644 --- a/tests/api_resources/cache/test_smart_tiered_cache.py +++ b/tests/api_resources/cache/test_smart_tiered_cache.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -26,7 +26,7 @@ def test_method_delete(self, client: Cloudflare) -> None: smart_tiered_cache = client.cache.smart_tiered_cache.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SmartTieredCacheDeleteResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheDeleteResponse], smart_tiered_cache, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -37,7 +37,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = response.parse() - assert_matches_type(SmartTieredCacheDeleteResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheDeleteResponse], smart_tiered_cache, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -48,7 +48,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = response.parse() - assert_matches_type(SmartTieredCacheDeleteResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheDeleteResponse], smart_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True @@ -65,7 +65,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(SmartTieredCacheEditResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheEditResponse], smart_tiered_cache, path=["response"]) @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: @@ -77,7 +77,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = response.parse() - assert_matches_type(SmartTieredCacheEditResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheEditResponse], smart_tiered_cache, path=["response"]) @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: @@ -89,7 +89,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = response.parse() - assert_matches_type(SmartTieredCacheEditResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheEditResponse], smart_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True @@ -106,7 +106,7 @@ def test_method_get(self, client: Cloudflare) -> None: smart_tiered_cache = client.cache.smart_tiered_cache.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SmartTieredCacheGetResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheGetResponse], smart_tiered_cache, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -117,7 +117,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = response.parse() - assert_matches_type(SmartTieredCacheGetResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheGetResponse], smart_tiered_cache, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -128,7 +128,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = response.parse() - assert_matches_type(SmartTieredCacheGetResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheGetResponse], smart_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True @@ -148,7 +148,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: smart_tiered_cache = await async_client.cache.smart_tiered_cache.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SmartTieredCacheDeleteResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheDeleteResponse], smart_tiered_cache, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -159,7 +159,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = await response.parse() - assert_matches_type(SmartTieredCacheDeleteResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheDeleteResponse], smart_tiered_cache, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -170,7 +170,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = await response.parse() - assert_matches_type(SmartTieredCacheDeleteResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheDeleteResponse], smart_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True @@ -187,7 +187,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(SmartTieredCacheEditResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheEditResponse], smart_tiered_cache, path=["response"]) @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -199,7 +199,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = await response.parse() - assert_matches_type(SmartTieredCacheEditResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheEditResponse], smart_tiered_cache, path=["response"]) @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -211,7 +211,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = await response.parse() - assert_matches_type(SmartTieredCacheEditResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheEditResponse], smart_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True @@ -228,7 +228,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: smart_tiered_cache = await async_client.cache.smart_tiered_cache.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SmartTieredCacheGetResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheGetResponse], smart_tiered_cache, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -239,7 +239,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = await response.parse() - assert_matches_type(SmartTieredCacheGetResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheGetResponse], smart_tiered_cache, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -250,7 +250,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = await response.parse() - assert_matches_type(SmartTieredCacheGetResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheGetResponse], smart_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cache/test_variants.py b/tests/api_resources/cache/test_variants.py index c46c601fbb8..9cb7356c449 100644 --- a/tests/api_resources/cache/test_variants.py +++ b/tests/api_resources/cache/test_variants.py @@ -3,13 +3,13 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.cache import CacheVariant, VariantGetResponse, VariantEditResponse +from cloudflare.types.cache import VariantGetResponse, VariantEditResponse, VariantDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,7 +22,7 @@ def test_method_delete(self, client: Cloudflare) -> None: variant = client.cache.variants.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CacheVariant, variant, path=["response"]) + assert_matches_type(Optional[VariantDeleteResponse], variant, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -33,7 +33,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = response.parse() - assert_matches_type(CacheVariant, variant, path=["response"]) + assert_matches_type(Optional[VariantDeleteResponse], variant, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -44,7 +44,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = response.parse() - assert_matches_type(CacheVariant, variant, path=["response"]) + assert_matches_type(Optional[VariantDeleteResponse], variant, path=["response"]) assert cast(Any, response.is_closed) is True @@ -55,14 +55,16 @@ def test_path_params_delete(self, client: Cloudflare) -> None: zone_id="", ) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_method_edit(self, client: Cloudflare) -> None: variant = client.cache.variants.edit( zone_id="023e105f4ecef8ad9ca31a8372d0c353", value={}, ) - assert_matches_type(VariantEditResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantEditResponse], variant, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_method_edit_with_all_params(self, client: Cloudflare) -> None: variant = client.cache.variants.edit( @@ -81,8 +83,9 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "webp": ["image/jpeg", "image/avif"], }, ) - assert_matches_type(VariantEditResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantEditResponse], variant, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: response = client.cache.variants.with_raw_response.edit( @@ -93,8 +96,9 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = response.parse() - assert_matches_type(VariantEditResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantEditResponse], variant, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: with client.cache.variants.with_streaming_response.edit( @@ -105,10 +109,11 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = response.parse() - assert_matches_type(VariantEditResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantEditResponse], variant, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_path_params_edit(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): @@ -117,13 +122,15 @@ def test_path_params_edit(self, client: Cloudflare) -> None: value={}, ) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_method_get(self, client: Cloudflare) -> None: variant = client.cache.variants.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(VariantGetResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantGetResponse], variant, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.cache.variants.with_raw_response.get( @@ -133,8 +140,9 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = response.parse() - assert_matches_type(VariantGetResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantGetResponse], variant, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.cache.variants.with_streaming_response.get( @@ -144,10 +152,11 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = response.parse() - assert_matches_type(VariantGetResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantGetResponse], variant, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_path_params_get(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): @@ -164,7 +173,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: variant = await async_client.cache.variants.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CacheVariant, variant, path=["response"]) + assert_matches_type(Optional[VariantDeleteResponse], variant, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -175,7 +184,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = await response.parse() - assert_matches_type(CacheVariant, variant, path=["response"]) + assert_matches_type(Optional[VariantDeleteResponse], variant, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -186,7 +195,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = await response.parse() - assert_matches_type(CacheVariant, variant, path=["response"]) + assert_matches_type(Optional[VariantDeleteResponse], variant, path=["response"]) assert cast(Any, response.is_closed) is True @@ -197,14 +206,16 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: zone_id="", ) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_method_edit(self, async_client: AsyncCloudflare) -> None: variant = await async_client.cache.variants.edit( zone_id="023e105f4ecef8ad9ca31a8372d0c353", value={}, ) - assert_matches_type(VariantEditResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantEditResponse], variant, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: variant = await async_client.cache.variants.edit( @@ -223,8 +234,9 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "webp": ["image/jpeg", "image/avif"], }, ) - assert_matches_type(VariantEditResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantEditResponse], variant, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: response = await async_client.cache.variants.with_raw_response.edit( @@ -235,8 +247,9 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = await response.parse() - assert_matches_type(VariantEditResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantEditResponse], variant, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: async with async_client.cache.variants.with_streaming_response.edit( @@ -247,10 +260,11 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = await response.parse() - assert_matches_type(VariantEditResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantEditResponse], variant, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): @@ -259,13 +273,15 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: value={}, ) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: variant = await async_client.cache.variants.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(VariantGetResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantGetResponse], variant, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.cache.variants.with_raw_response.get( @@ -275,8 +291,9 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = await response.parse() - assert_matches_type(VariantGetResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantGetResponse], variant, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.cache.variants.with_streaming_response.get( @@ -286,10 +303,11 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = await response.parse() - assert_matches_type(VariantGetResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantGetResponse], variant, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): diff --git a/tests/api_resources/cloud_connector/test_rules.py b/tests/api_resources/cloud_connector/test_rules.py index 3516a2e2848..4c8dbcafd19 100644 --- a/tests/api_resources/cloud_connector/test_rules.py +++ b/tests/api_resources/cloud_connector/test_rules.py @@ -22,7 +22,7 @@ class TestRules: def test_method_update(self, client: Cloudflare) -> None: rule = client.cloud_connector.rules.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[{}], + rules=[{}], ) assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) @@ -30,7 +30,7 @@ def test_method_update(self, client: Cloudflare) -> None: def test_raw_response_update(self, client: Cloudflare) -> None: response = client.cloud_connector.rules.with_raw_response.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[{}], + rules=[{}], ) assert response.is_closed is True @@ -42,7 +42,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: def test_streaming_response_update(self, client: Cloudflare) -> None: with client.cloud_connector.rules.with_streaming_response.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[{}], + rules=[{}], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -57,7 +57,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.cloud_connector.rules.with_raw_response.update( zone_id="", - body=[{}], + rules=[{}], ) @parametrize @@ -106,7 +106,7 @@ class TestAsyncRules: async def test_method_update(self, async_client: AsyncCloudflare) -> None: rule = await async_client.cloud_connector.rules.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[{}], + rules=[{}], ) assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) @@ -114,7 +114,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.cloud_connector.rules.with_raw_response.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[{}], + rules=[{}], ) assert response.is_closed is True @@ -126,7 +126,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.cloud_connector.rules.with_streaming_response.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[{}], + rules=[{}], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -141,7 +141,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.cloud_connector.rules.with_raw_response.update( zone_id="", - body=[{}], + rules=[{}], ) @parametrize diff --git a/tests/api_resources/dns/test_records.py b/tests/api_resources/dns/test_records.py index aa64f3c8ac3..d66e3f1af77 100644 --- a/tests/api_resources/dns/test_records.py +++ b/tests/api_resources/dns/test_records.py @@ -10,15 +10,11 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.types.dns import ( - RecordGetResponse, - RecordEditResponse, - RecordListResponse, + RecordResponse, RecordScanResponse, RecordBatchResponse, - RecordCreateResponse, RecordDeleteResponse, RecordImportResponse, - RecordUpdateResponse, ) from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray @@ -34,7 +30,7 @@ def test_method_create_overload_1(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -45,11 +41,15 @@ def test_method_create_with_all_params_overload_1(self, client: Cloudflare) -> N content="198.51.100.4", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="A", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -61,7 +61,7 @@ def test_raw_response_create_overload_1(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -73,7 +73,7 @@ def test_streaming_response_create_overload_1(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -91,7 +91,7 @@ def test_method_create_overload_2(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -102,11 +102,15 @@ def test_method_create_with_all_params_overload_2(self, client: Cloudflare) -> N content="2400:cb00:2049::1", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="AAAA", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -118,7 +122,7 @@ def test_raw_response_create_overload_2(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -130,7 +134,7 @@ def test_streaming_response_create_overload_2(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -148,7 +152,7 @@ def test_method_create_overload_3(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -163,11 +167,15 @@ def test_method_create_with_all_params_overload_3(self, client: Cloudflare) -> N }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="CAA", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -179,7 +187,7 @@ def test_raw_response_create_overload_3(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -191,7 +199,7 @@ def test_streaming_response_create_overload_3(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -209,7 +217,7 @@ def test_method_create_overload_4(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -225,11 +233,15 @@ def test_method_create_with_all_params_overload_4(self, client: Cloudflare) -> N }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="CERT", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -241,7 +253,7 @@ def test_raw_response_create_overload_4(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -253,7 +265,7 @@ def test_streaming_response_create_overload_4(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -271,7 +283,7 @@ def test_method_create_overload_5(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -282,12 +294,16 @@ def test_method_create_with_all_params_overload_5(self, client: Cloudflare) -> N content="content", name="example.com", proxied=True, - settings={"flatten_cname": True}, + settings={ + "flatten_cname": True, + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="CNAME", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -299,7 +315,7 @@ def test_raw_response_create_overload_5(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -311,7 +327,7 @@ def test_streaming_response_create_overload_5(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -329,7 +345,7 @@ def test_method_create_overload_6(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -345,11 +361,15 @@ def test_method_create_with_all_params_overload_6(self, client: Cloudflare) -> N }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="DNSKEY", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -361,7 +381,7 @@ def test_raw_response_create_overload_6(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -373,7 +393,7 @@ def test_streaming_response_create_overload_6(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -391,7 +411,7 @@ def test_method_create_overload_7(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -407,11 +427,15 @@ def test_method_create_with_all_params_overload_7(self, client: Cloudflare) -> N }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="DS", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -423,7 +447,7 @@ def test_raw_response_create_overload_7(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -435,7 +459,7 @@ def test_streaming_response_create_overload_7(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -453,7 +477,7 @@ def test_method_create_overload_8(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -468,11 +492,15 @@ def test_method_create_with_all_params_overload_8(self, client: Cloudflare) -> N }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="HTTPS", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -484,7 +512,7 @@ def test_raw_response_create_overload_8(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -496,7 +524,7 @@ def test_streaming_response_create_overload_8(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -514,7 +542,7 @@ def test_method_create_overload_9(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -538,11 +566,15 @@ def test_method_create_with_all_params_overload_9(self, client: Cloudflare) -> N }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="LOC", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -554,7 +586,7 @@ def test_raw_response_create_overload_9(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -566,7 +598,7 @@ def test_streaming_response_create_overload_9(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -584,7 +616,7 @@ def test_method_create_overload_10(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -596,11 +628,15 @@ def test_method_create_with_all_params_overload_10(self, client: Cloudflare) -> name="example.com", priority=10, proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="MX", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -612,7 +648,7 @@ def test_raw_response_create_overload_10(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -624,7 +660,7 @@ def test_streaming_response_create_overload_10(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -642,7 +678,7 @@ def test_method_create_overload_11(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -660,11 +696,15 @@ def test_method_create_with_all_params_overload_11(self, client: Cloudflare) -> }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="NAPTR", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -676,7 +716,7 @@ def test_raw_response_create_overload_11(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -688,7 +728,7 @@ def test_streaming_response_create_overload_11(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -706,7 +746,7 @@ def test_method_create_overload_12(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -717,11 +757,15 @@ def test_method_create_with_all_params_overload_12(self, client: Cloudflare) -> content="ns1.example.com", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="NS", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -733,7 +777,7 @@ def test_raw_response_create_overload_12(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -745,7 +789,7 @@ def test_streaming_response_create_overload_12(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -763,7 +807,7 @@ def test_method_create_overload_13(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -774,11 +818,15 @@ def test_method_create_with_all_params_overload_13(self, client: Cloudflare) -> content="content", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="OPENPGPKEY", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -790,7 +838,7 @@ def test_raw_response_create_overload_13(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -802,7 +850,7 @@ def test_streaming_response_create_overload_13(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -820,7 +868,7 @@ def test_method_create_overload_14(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -831,11 +879,15 @@ def test_method_create_with_all_params_overload_14(self, client: Cloudflare) -> content="example.com", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="PTR", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -847,7 +899,7 @@ def test_raw_response_create_overload_14(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -859,7 +911,7 @@ def test_streaming_response_create_overload_14(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -877,7 +929,7 @@ def test_method_create_overload_15(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -893,11 +945,15 @@ def test_method_create_with_all_params_overload_15(self, client: Cloudflare) -> }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SMIMEA", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -909,7 +965,7 @@ def test_raw_response_create_overload_15(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -921,7 +977,7 @@ def test_streaming_response_create_overload_15(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -939,7 +995,7 @@ def test_method_create_overload_16(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -955,11 +1011,15 @@ def test_method_create_with_all_params_overload_16(self, client: Cloudflare) -> }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SRV", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -971,7 +1031,7 @@ def test_raw_response_create_overload_16(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -983,7 +1043,7 @@ def test_streaming_response_create_overload_16(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1001,7 +1061,7 @@ def test_method_create_overload_17(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1016,11 +1076,15 @@ def test_method_create_with_all_params_overload_17(self, client: Cloudflare) -> }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SSHFP", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1032,7 +1096,7 @@ def test_raw_response_create_overload_17(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1044,7 +1108,7 @@ def test_streaming_response_create_overload_17(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1062,7 +1126,7 @@ def test_method_create_overload_18(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1077,11 +1141,15 @@ def test_method_create_with_all_params_overload_18(self, client: Cloudflare) -> }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SVCB", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1093,7 +1161,7 @@ def test_raw_response_create_overload_18(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1105,7 +1173,7 @@ def test_streaming_response_create_overload_18(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1123,7 +1191,7 @@ def test_method_create_overload_19(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1139,11 +1207,15 @@ def test_method_create_with_all_params_overload_19(self, client: Cloudflare) -> }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="TLSA", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1155,7 +1227,7 @@ def test_raw_response_create_overload_19(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1167,7 +1239,7 @@ def test_streaming_response_create_overload_19(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1185,7 +1257,7 @@ def test_method_create_overload_20(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1196,11 +1268,15 @@ def test_method_create_with_all_params_overload_20(self, client: Cloudflare) -> content='"v=spf1 include:example.com -all"', name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="TXT", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1212,7 +1288,7 @@ def test_raw_response_create_overload_20(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1224,7 +1300,7 @@ def test_streaming_response_create_overload_20(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1242,7 +1318,7 @@ def test_method_create_overload_21(self, client: Cloudflare) -> None: record = client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1257,11 +1333,15 @@ def test_method_create_with_all_params_overload_21(self, client: Cloudflare) -> name="example.com", priority=10, proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="URI", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1273,7 +1353,7 @@ def test_raw_response_create_overload_21(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1285,7 +1365,7 @@ def test_streaming_response_create_overload_21(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1304,7 +1384,7 @@ def test_method_update_overload_1(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1316,11 +1396,15 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N content="198.51.100.4", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="A", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1333,7 +1417,7 @@ def test_raw_response_update_overload_1(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1346,7 +1430,7 @@ def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1372,7 +1456,7 @@ def test_method_update_overload_2(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1384,11 +1468,15 @@ def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> N content="2400:cb00:2049::1", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="AAAA", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1401,7 +1489,7 @@ def test_raw_response_update_overload_2(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1414,7 +1502,7 @@ def test_streaming_response_update_overload_2(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1440,7 +1528,7 @@ def test_method_update_overload_3(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1456,11 +1544,15 @@ def test_method_update_with_all_params_overload_3(self, client: Cloudflare) -> N }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="CAA", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1473,7 +1565,7 @@ def test_raw_response_update_overload_3(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1486,7 +1578,7 @@ def test_streaming_response_update_overload_3(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1512,7 +1604,7 @@ def test_method_update_overload_4(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1529,11 +1621,15 @@ def test_method_update_with_all_params_overload_4(self, client: Cloudflare) -> N }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="CERT", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1546,7 +1642,7 @@ def test_raw_response_update_overload_4(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1559,7 +1655,7 @@ def test_streaming_response_update_overload_4(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1585,7 +1681,7 @@ def test_method_update_overload_5(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1597,12 +1693,16 @@ def test_method_update_with_all_params_overload_5(self, client: Cloudflare) -> N content="content", name="example.com", proxied=True, - settings={"flatten_cname": True}, + settings={ + "flatten_cname": True, + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="CNAME", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1615,7 +1715,7 @@ def test_raw_response_update_overload_5(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1628,7 +1728,7 @@ def test_streaming_response_update_overload_5(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1654,7 +1754,7 @@ def test_method_update_overload_6(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1671,11 +1771,15 @@ def test_method_update_with_all_params_overload_6(self, client: Cloudflare) -> N }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="DNSKEY", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1688,7 +1792,7 @@ def test_raw_response_update_overload_6(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1701,7 +1805,7 @@ def test_streaming_response_update_overload_6(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1727,7 +1831,7 @@ def test_method_update_overload_7(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1744,11 +1848,15 @@ def test_method_update_with_all_params_overload_7(self, client: Cloudflare) -> N }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="DS", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1761,7 +1869,7 @@ def test_raw_response_update_overload_7(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1774,7 +1882,7 @@ def test_streaming_response_update_overload_7(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1800,7 +1908,7 @@ def test_method_update_overload_8(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1816,11 +1924,15 @@ def test_method_update_with_all_params_overload_8(self, client: Cloudflare) -> N }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="HTTPS", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1833,7 +1945,7 @@ def test_raw_response_update_overload_8(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1846,7 +1958,7 @@ def test_streaming_response_update_overload_8(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1872,7 +1984,7 @@ def test_method_update_overload_9(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1897,11 +2009,15 @@ def test_method_update_with_all_params_overload_9(self, client: Cloudflare) -> N }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="LOC", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1914,7 +2030,7 @@ def test_raw_response_update_overload_9(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1927,7 +2043,7 @@ def test_streaming_response_update_overload_9(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1953,7 +2069,7 @@ def test_method_update_overload_10(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1966,11 +2082,15 @@ def test_method_update_with_all_params_overload_10(self, client: Cloudflare) -> name="example.com", priority=10, proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="MX", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1983,7 +2103,7 @@ def test_raw_response_update_overload_10(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1996,7 +2116,7 @@ def test_streaming_response_update_overload_10(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2022,7 +2142,7 @@ def test_method_update_overload_11(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2041,11 +2161,15 @@ def test_method_update_with_all_params_overload_11(self, client: Cloudflare) -> }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="NAPTR", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2058,7 +2182,7 @@ def test_raw_response_update_overload_11(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2071,7 +2195,7 @@ def test_streaming_response_update_overload_11(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2097,7 +2221,7 @@ def test_method_update_overload_12(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2109,11 +2233,15 @@ def test_method_update_with_all_params_overload_12(self, client: Cloudflare) -> content="ns1.example.com", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="NS", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2126,7 +2254,7 @@ def test_raw_response_update_overload_12(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2139,7 +2267,7 @@ def test_streaming_response_update_overload_12(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2165,7 +2293,7 @@ def test_method_update_overload_13(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2177,11 +2305,15 @@ def test_method_update_with_all_params_overload_13(self, client: Cloudflare) -> content="content", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="OPENPGPKEY", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2194,7 +2326,7 @@ def test_raw_response_update_overload_13(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2207,7 +2339,7 @@ def test_streaming_response_update_overload_13(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2233,7 +2365,7 @@ def test_method_update_overload_14(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2245,11 +2377,15 @@ def test_method_update_with_all_params_overload_14(self, client: Cloudflare) -> content="example.com", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="PTR", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2262,7 +2398,7 @@ def test_raw_response_update_overload_14(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2275,7 +2411,7 @@ def test_streaming_response_update_overload_14(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2301,7 +2437,7 @@ def test_method_update_overload_15(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2318,11 +2454,15 @@ def test_method_update_with_all_params_overload_15(self, client: Cloudflare) -> }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SMIMEA", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2335,7 +2475,7 @@ def test_raw_response_update_overload_15(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2348,7 +2488,7 @@ def test_streaming_response_update_overload_15(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2374,7 +2514,7 @@ def test_method_update_overload_16(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2391,11 +2531,15 @@ def test_method_update_with_all_params_overload_16(self, client: Cloudflare) -> }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SRV", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2408,7 +2552,7 @@ def test_raw_response_update_overload_16(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2421,7 +2565,7 @@ def test_streaming_response_update_overload_16(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2447,7 +2591,7 @@ def test_method_update_overload_17(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2463,11 +2607,15 @@ def test_method_update_with_all_params_overload_17(self, client: Cloudflare) -> }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SSHFP", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2480,7 +2628,7 @@ def test_raw_response_update_overload_17(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2493,7 +2641,7 @@ def test_streaming_response_update_overload_17(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2519,7 +2667,7 @@ def test_method_update_overload_18(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2535,11 +2683,15 @@ def test_method_update_with_all_params_overload_18(self, client: Cloudflare) -> }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SVCB", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2552,7 +2704,7 @@ def test_raw_response_update_overload_18(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2565,7 +2717,7 @@ def test_streaming_response_update_overload_18(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2591,7 +2743,7 @@ def test_method_update_overload_19(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2608,11 +2760,15 @@ def test_method_update_with_all_params_overload_19(self, client: Cloudflare) -> }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="TLSA", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2625,7 +2781,7 @@ def test_raw_response_update_overload_19(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2638,7 +2794,7 @@ def test_streaming_response_update_overload_19(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2664,7 +2820,7 @@ def test_method_update_overload_20(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2676,11 +2832,15 @@ def test_method_update_with_all_params_overload_20(self, client: Cloudflare) -> content='"v=spf1 include:example.com -all"', name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="TXT", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2693,7 +2853,7 @@ def test_raw_response_update_overload_20(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2706,7 +2866,7 @@ def test_streaming_response_update_overload_20(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2732,7 +2892,7 @@ def test_method_update_overload_21(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2748,11 +2908,15 @@ def test_method_update_with_all_params_overload_21(self, client: Cloudflare) -> name="example.com", priority=10, proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="URI", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2765,7 +2929,7 @@ def test_raw_response_update_overload_21(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2778,7 +2942,7 @@ def test_streaming_response_update_overload_21(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2797,13 +2961,15 @@ def test_path_params_update_overload_21(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) + @pytest.mark.skip(reason="mock server returns invalid data") @parametrize def test_method_list(self, client: Cloudflare) -> None: record = client.dns.records.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[RecordListResponse], record, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[RecordResponse], record, path=["response"]) + @pytest.mark.skip(reason="mock server returns invalid data") @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: record = client.dns.records.list( @@ -2846,8 +3012,9 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: tag_match="any", type="A", ) - assert_matches_type(SyncV4PagePaginationArray[RecordListResponse], record, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[RecordResponse], record, path=["response"]) + @pytest.mark.skip(reason="mock server returns invalid data") @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.dns.records.with_raw_response.list( @@ -2857,8 +3024,9 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(SyncV4PagePaginationArray[RecordListResponse], record, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[RecordResponse], record, path=["response"]) + @pytest.mark.skip(reason="mock server returns invalid data") @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: with client.dns.records.with_streaming_response.list( @@ -2868,10 +3036,11 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(SyncV4PagePaginationArray[RecordListResponse], record, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="mock server returns invalid data") @parametrize def test_path_params_list(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): @@ -2947,6 +3116,10 @@ def test_method_batch_with_all_params(self, client: Cloudflare) -> None: "content": "198.51.100.4", "name": "example.com", "proxied": True, + "settings": { + "ipv4_only": True, + "ipv6_only": True, + }, "tags": ["owner:dns-team"], "ttl": 3600, "type": "A", @@ -2959,6 +3132,10 @@ def test_method_batch_with_all_params(self, client: Cloudflare) -> None: "content": "198.51.100.4", "name": "example.com", "proxied": True, + "settings": { + "ipv4_only": True, + "ipv6_only": True, + }, "tags": ["owner:dns-team"], "ttl": 3600, "type": "A", @@ -2970,6 +3147,10 @@ def test_method_batch_with_all_params(self, client: Cloudflare) -> None: "content": "198.51.100.4", "name": "example.com", "proxied": True, + "settings": { + "ipv4_only": True, + "ipv6_only": True, + }, "tags": ["owner:dns-team"], "ttl": 3600, "type": "A", @@ -3020,7 +3201,7 @@ def test_method_edit_overload_1(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3032,11 +3213,15 @@ def test_method_edit_with_all_params_overload_1(self, client: Cloudflare) -> Non content="198.51.100.4", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="A", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3049,7 +3234,7 @@ def test_raw_response_edit_overload_1(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3062,7 +3247,7 @@ def test_streaming_response_edit_overload_1(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3088,7 +3273,7 @@ def test_method_edit_overload_2(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3100,11 +3285,15 @@ def test_method_edit_with_all_params_overload_2(self, client: Cloudflare) -> Non content="2400:cb00:2049::1", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="AAAA", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3117,7 +3306,7 @@ def test_raw_response_edit_overload_2(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3130,7 +3319,7 @@ def test_streaming_response_edit_overload_2(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3156,7 +3345,7 @@ def test_method_edit_overload_3(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3172,11 +3361,15 @@ def test_method_edit_with_all_params_overload_3(self, client: Cloudflare) -> Non }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="CAA", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3189,7 +3382,7 @@ def test_raw_response_edit_overload_3(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3202,7 +3395,7 @@ def test_streaming_response_edit_overload_3(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3228,7 +3421,7 @@ def test_method_edit_overload_4(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3245,11 +3438,15 @@ def test_method_edit_with_all_params_overload_4(self, client: Cloudflare) -> Non }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="CERT", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3262,7 +3459,7 @@ def test_raw_response_edit_overload_4(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3275,7 +3472,7 @@ def test_streaming_response_edit_overload_4(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3301,7 +3498,7 @@ def test_method_edit_overload_5(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3313,12 +3510,16 @@ def test_method_edit_with_all_params_overload_5(self, client: Cloudflare) -> Non content="content", name="example.com", proxied=True, - settings={"flatten_cname": True}, + settings={ + "flatten_cname": True, + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="CNAME", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3331,7 +3532,7 @@ def test_raw_response_edit_overload_5(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3344,7 +3545,7 @@ def test_streaming_response_edit_overload_5(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3370,7 +3571,7 @@ def test_method_edit_overload_6(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3387,11 +3588,15 @@ def test_method_edit_with_all_params_overload_6(self, client: Cloudflare) -> Non }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="DNSKEY", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3404,7 +3609,7 @@ def test_raw_response_edit_overload_6(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3417,7 +3622,7 @@ def test_streaming_response_edit_overload_6(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3443,7 +3648,7 @@ def test_method_edit_overload_7(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3460,11 +3665,15 @@ def test_method_edit_with_all_params_overload_7(self, client: Cloudflare) -> Non }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="DS", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3477,7 +3686,7 @@ def test_raw_response_edit_overload_7(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3490,7 +3699,7 @@ def test_streaming_response_edit_overload_7(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3516,7 +3725,7 @@ def test_method_edit_overload_8(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3532,11 +3741,15 @@ def test_method_edit_with_all_params_overload_8(self, client: Cloudflare) -> Non }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="HTTPS", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3549,7 +3762,7 @@ def test_raw_response_edit_overload_8(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3562,7 +3775,7 @@ def test_streaming_response_edit_overload_8(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3588,7 +3801,7 @@ def test_method_edit_overload_9(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3613,11 +3826,15 @@ def test_method_edit_with_all_params_overload_9(self, client: Cloudflare) -> Non }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="LOC", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3630,7 +3847,7 @@ def test_raw_response_edit_overload_9(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3643,7 +3860,7 @@ def test_streaming_response_edit_overload_9(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3669,7 +3886,7 @@ def test_method_edit_overload_10(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3682,11 +3899,15 @@ def test_method_edit_with_all_params_overload_10(self, client: Cloudflare) -> No name="example.com", priority=10, proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="MX", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3699,7 +3920,7 @@ def test_raw_response_edit_overload_10(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3712,7 +3933,7 @@ def test_streaming_response_edit_overload_10(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3738,7 +3959,7 @@ def test_method_edit_overload_11(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3757,11 +3978,15 @@ def test_method_edit_with_all_params_overload_11(self, client: Cloudflare) -> No }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="NAPTR", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3774,7 +3999,7 @@ def test_raw_response_edit_overload_11(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3787,7 +4012,7 @@ def test_streaming_response_edit_overload_11(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3813,7 +4038,7 @@ def test_method_edit_overload_12(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3825,11 +4050,15 @@ def test_method_edit_with_all_params_overload_12(self, client: Cloudflare) -> No content="ns1.example.com", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="NS", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3842,7 +4071,7 @@ def test_raw_response_edit_overload_12(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3855,7 +4084,7 @@ def test_streaming_response_edit_overload_12(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3881,7 +4110,7 @@ def test_method_edit_overload_13(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3893,11 +4122,15 @@ def test_method_edit_with_all_params_overload_13(self, client: Cloudflare) -> No content="content", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="OPENPGPKEY", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3910,7 +4143,7 @@ def test_raw_response_edit_overload_13(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3923,7 +4156,7 @@ def test_streaming_response_edit_overload_13(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3949,7 +4182,7 @@ def test_method_edit_overload_14(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3961,11 +4194,15 @@ def test_method_edit_with_all_params_overload_14(self, client: Cloudflare) -> No content="example.com", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="PTR", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3978,7 +4215,7 @@ def test_raw_response_edit_overload_14(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3991,7 +4228,7 @@ def test_streaming_response_edit_overload_14(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4017,7 +4254,7 @@ def test_method_edit_overload_15(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4034,11 +4271,15 @@ def test_method_edit_with_all_params_overload_15(self, client: Cloudflare) -> No }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SMIMEA", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4051,7 +4292,7 @@ def test_raw_response_edit_overload_15(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4064,7 +4305,7 @@ def test_streaming_response_edit_overload_15(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4090,7 +4331,7 @@ def test_method_edit_overload_16(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4107,11 +4348,15 @@ def test_method_edit_with_all_params_overload_16(self, client: Cloudflare) -> No }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SRV", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4124,7 +4369,7 @@ def test_raw_response_edit_overload_16(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4137,7 +4382,7 @@ def test_streaming_response_edit_overload_16(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4163,7 +4408,7 @@ def test_method_edit_overload_17(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4179,11 +4424,15 @@ def test_method_edit_with_all_params_overload_17(self, client: Cloudflare) -> No }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SSHFP", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4196,7 +4445,7 @@ def test_raw_response_edit_overload_17(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4209,7 +4458,7 @@ def test_streaming_response_edit_overload_17(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4235,7 +4484,7 @@ def test_method_edit_overload_18(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4251,11 +4500,15 @@ def test_method_edit_with_all_params_overload_18(self, client: Cloudflare) -> No }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SVCB", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4268,7 +4521,7 @@ def test_raw_response_edit_overload_18(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4281,7 +4534,7 @@ def test_streaming_response_edit_overload_18(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4307,7 +4560,7 @@ def test_method_edit_overload_19(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4324,11 +4577,15 @@ def test_method_edit_with_all_params_overload_19(self, client: Cloudflare) -> No }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="TLSA", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4341,7 +4598,7 @@ def test_raw_response_edit_overload_19(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4354,7 +4611,7 @@ def test_streaming_response_edit_overload_19(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4380,7 +4637,7 @@ def test_method_edit_overload_20(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4392,11 +4649,15 @@ def test_method_edit_with_all_params_overload_20(self, client: Cloudflare) -> No content='"v=spf1 include:example.com -all"', name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="TXT", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4409,7 +4670,7 @@ def test_raw_response_edit_overload_20(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4422,7 +4683,7 @@ def test_streaming_response_edit_overload_20(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4448,7 +4709,7 @@ def test_method_edit_overload_21(self, client: Cloudflare) -> None: dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4464,11 +4725,15 @@ def test_method_edit_with_all_params_overload_21(self, client: Cloudflare) -> No name="example.com", priority=10, proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="URI", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4481,7 +4746,7 @@ def test_raw_response_edit_overload_21(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4494,7 +4759,7 @@ def test_streaming_response_edit_overload_21(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4551,14 +4816,16 @@ def test_path_params_export(self, client: Cloudflare) -> None: zone_id="", ) + @pytest.mark.skip(reason="mock server returns invalid data") @parametrize def test_method_get(self, client: Cloudflare) -> None: record = client.dns.records.get( dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordGetResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) + @pytest.mark.skip(reason="mock server returns invalid data") @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.dns.records.with_raw_response.get( @@ -4569,8 +4836,9 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordGetResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) + @pytest.mark.skip(reason="mock server returns invalid data") @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.dns.records.with_streaming_response.get( @@ -4581,10 +4849,11 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(Optional[RecordGetResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="mock server returns invalid data") @parametrize def test_path_params_get(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): @@ -4707,7 +4976,7 @@ async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4718,11 +4987,15 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn content="198.51.100.4", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="A", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4734,7 +5007,7 @@ async def test_raw_response_create_overload_1(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4746,7 +5019,7 @@ async def test_streaming_response_create_overload_1(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4764,7 +5037,7 @@ async def test_method_create_overload_2(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4775,11 +5048,15 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn content="2400:cb00:2049::1", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="AAAA", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4791,7 +5068,7 @@ async def test_raw_response_create_overload_2(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4803,7 +5080,7 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4821,7 +5098,7 @@ async def test_method_create_overload_3(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4836,11 +5113,15 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="CAA", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4852,7 +5133,7 @@ async def test_raw_response_create_overload_3(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4864,7 +5145,7 @@ async def test_streaming_response_create_overload_3(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4882,7 +5163,7 @@ async def test_method_create_overload_4(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4898,11 +5179,15 @@ async def test_method_create_with_all_params_overload_4(self, async_client: Asyn }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="CERT", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4914,7 +5199,7 @@ async def test_raw_response_create_overload_4(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4926,7 +5211,7 @@ async def test_streaming_response_create_overload_4(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4944,7 +5229,7 @@ async def test_method_create_overload_5(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4955,12 +5240,16 @@ async def test_method_create_with_all_params_overload_5(self, async_client: Asyn content="content", name="example.com", proxied=True, - settings={"flatten_cname": True}, + settings={ + "flatten_cname": True, + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="CNAME", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4972,7 +5261,7 @@ async def test_raw_response_create_overload_5(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -4984,7 +5273,7 @@ async def test_streaming_response_create_overload_5(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5002,7 +5291,7 @@ async def test_method_create_overload_6(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5018,11 +5307,15 @@ async def test_method_create_with_all_params_overload_6(self, async_client: Asyn }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="DNSKEY", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5034,7 +5327,7 @@ async def test_raw_response_create_overload_6(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5046,7 +5339,7 @@ async def test_streaming_response_create_overload_6(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5064,7 +5357,7 @@ async def test_method_create_overload_7(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5080,11 +5373,15 @@ async def test_method_create_with_all_params_overload_7(self, async_client: Asyn }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="DS", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5096,7 +5393,7 @@ async def test_raw_response_create_overload_7(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5108,7 +5405,7 @@ async def test_streaming_response_create_overload_7(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5126,7 +5423,7 @@ async def test_method_create_overload_8(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5141,11 +5438,15 @@ async def test_method_create_with_all_params_overload_8(self, async_client: Asyn }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="HTTPS", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5157,7 +5458,7 @@ async def test_raw_response_create_overload_8(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5169,7 +5470,7 @@ async def test_streaming_response_create_overload_8(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5187,7 +5488,7 @@ async def test_method_create_overload_9(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5211,11 +5512,15 @@ async def test_method_create_with_all_params_overload_9(self, async_client: Asyn }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="LOC", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5227,7 +5532,7 @@ async def test_raw_response_create_overload_9(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5239,7 +5544,7 @@ async def test_streaming_response_create_overload_9(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5257,7 +5562,7 @@ async def test_method_create_overload_10(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5269,11 +5574,15 @@ async def test_method_create_with_all_params_overload_10(self, async_client: Asy name="example.com", priority=10, proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="MX", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5285,7 +5594,7 @@ async def test_raw_response_create_overload_10(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5297,7 +5606,7 @@ async def test_streaming_response_create_overload_10(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5315,7 +5624,7 @@ async def test_method_create_overload_11(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5333,11 +5642,15 @@ async def test_method_create_with_all_params_overload_11(self, async_client: Asy }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="NAPTR", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5349,7 +5662,7 @@ async def test_raw_response_create_overload_11(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5361,7 +5674,7 @@ async def test_streaming_response_create_overload_11(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5379,7 +5692,7 @@ async def test_method_create_overload_12(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5390,11 +5703,15 @@ async def test_method_create_with_all_params_overload_12(self, async_client: Asy content="ns1.example.com", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="NS", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5406,7 +5723,7 @@ async def test_raw_response_create_overload_12(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5418,7 +5735,7 @@ async def test_streaming_response_create_overload_12(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5436,7 +5753,7 @@ async def test_method_create_overload_13(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5447,11 +5764,15 @@ async def test_method_create_with_all_params_overload_13(self, async_client: Asy content="content", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="OPENPGPKEY", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5463,7 +5784,7 @@ async def test_raw_response_create_overload_13(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5475,7 +5796,7 @@ async def test_streaming_response_create_overload_13(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5493,7 +5814,7 @@ async def test_method_create_overload_14(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5504,11 +5825,15 @@ async def test_method_create_with_all_params_overload_14(self, async_client: Asy content="example.com", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="PTR", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5520,7 +5845,7 @@ async def test_raw_response_create_overload_14(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5532,7 +5857,7 @@ async def test_streaming_response_create_overload_14(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5550,7 +5875,7 @@ async def test_method_create_overload_15(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5566,11 +5891,15 @@ async def test_method_create_with_all_params_overload_15(self, async_client: Asy }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SMIMEA", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5582,7 +5911,7 @@ async def test_raw_response_create_overload_15(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5594,7 +5923,7 @@ async def test_streaming_response_create_overload_15(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5612,7 +5941,7 @@ async def test_method_create_overload_16(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5628,11 +5957,15 @@ async def test_method_create_with_all_params_overload_16(self, async_client: Asy }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SRV", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5644,7 +5977,7 @@ async def test_raw_response_create_overload_16(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5656,7 +5989,7 @@ async def test_streaming_response_create_overload_16(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5674,7 +6007,7 @@ async def test_method_create_overload_17(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5689,11 +6022,15 @@ async def test_method_create_with_all_params_overload_17(self, async_client: Asy }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SSHFP", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5705,7 +6042,7 @@ async def test_raw_response_create_overload_17(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5717,7 +6054,7 @@ async def test_streaming_response_create_overload_17(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5735,7 +6072,7 @@ async def test_method_create_overload_18(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5750,11 +6087,15 @@ async def test_method_create_with_all_params_overload_18(self, async_client: Asy }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SVCB", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5766,7 +6107,7 @@ async def test_raw_response_create_overload_18(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5778,7 +6119,7 @@ async def test_streaming_response_create_overload_18(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5796,7 +6137,7 @@ async def test_method_create_overload_19(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5812,11 +6153,15 @@ async def test_method_create_with_all_params_overload_19(self, async_client: Asy }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="TLSA", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5828,7 +6173,7 @@ async def test_raw_response_create_overload_19(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5840,7 +6185,7 @@ async def test_streaming_response_create_overload_19(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5858,7 +6203,7 @@ async def test_method_create_overload_20(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5869,11 +6214,15 @@ async def test_method_create_with_all_params_overload_20(self, async_client: Asy content='"v=spf1 include:example.com -all"', name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="TXT", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5885,7 +6234,7 @@ async def test_raw_response_create_overload_20(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5897,7 +6246,7 @@ async def test_streaming_response_create_overload_20(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5915,7 +6264,7 @@ async def test_method_create_overload_21(self, async_client: AsyncCloudflare) -> record = await async_client.dns.records.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5930,11 +6279,15 @@ async def test_method_create_with_all_params_overload_21(self, async_client: Asy name="example.com", priority=10, proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="URI", ) - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5946,7 +6299,7 @@ async def test_raw_response_create_overload_21(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5958,7 +6311,7 @@ async def test_streaming_response_create_overload_21(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordCreateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5977,7 +6330,7 @@ async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -5989,11 +6342,15 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn content="198.51.100.4", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="A", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6006,7 +6363,7 @@ async def test_raw_response_update_overload_1(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6019,7 +6376,7 @@ async def test_streaming_response_update_overload_1(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6045,7 +6402,7 @@ async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6057,11 +6414,15 @@ async def test_method_update_with_all_params_overload_2(self, async_client: Asyn content="2400:cb00:2049::1", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="AAAA", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6074,7 +6435,7 @@ async def test_raw_response_update_overload_2(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6087,7 +6448,7 @@ async def test_streaming_response_update_overload_2(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6113,7 +6474,7 @@ async def test_method_update_overload_3(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6129,11 +6490,15 @@ async def test_method_update_with_all_params_overload_3(self, async_client: Asyn }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="CAA", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6146,7 +6511,7 @@ async def test_raw_response_update_overload_3(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6159,7 +6524,7 @@ async def test_streaming_response_update_overload_3(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6185,7 +6550,7 @@ async def test_method_update_overload_4(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6202,11 +6567,15 @@ async def test_method_update_with_all_params_overload_4(self, async_client: Asyn }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="CERT", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6219,7 +6588,7 @@ async def test_raw_response_update_overload_4(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6232,7 +6601,7 @@ async def test_streaming_response_update_overload_4(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6258,7 +6627,7 @@ async def test_method_update_overload_5(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6270,12 +6639,16 @@ async def test_method_update_with_all_params_overload_5(self, async_client: Asyn content="content", name="example.com", proxied=True, - settings={"flatten_cname": True}, + settings={ + "flatten_cname": True, + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="CNAME", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6288,7 +6661,7 @@ async def test_raw_response_update_overload_5(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6301,7 +6674,7 @@ async def test_streaming_response_update_overload_5(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6327,7 +6700,7 @@ async def test_method_update_overload_6(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6344,11 +6717,15 @@ async def test_method_update_with_all_params_overload_6(self, async_client: Asyn }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="DNSKEY", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6361,7 +6738,7 @@ async def test_raw_response_update_overload_6(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6374,7 +6751,7 @@ async def test_streaming_response_update_overload_6(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6400,7 +6777,7 @@ async def test_method_update_overload_7(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6417,11 +6794,15 @@ async def test_method_update_with_all_params_overload_7(self, async_client: Asyn }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="DS", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6434,7 +6815,7 @@ async def test_raw_response_update_overload_7(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6447,7 +6828,7 @@ async def test_streaming_response_update_overload_7(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6473,7 +6854,7 @@ async def test_method_update_overload_8(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6489,11 +6870,15 @@ async def test_method_update_with_all_params_overload_8(self, async_client: Asyn }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="HTTPS", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6506,7 +6891,7 @@ async def test_raw_response_update_overload_8(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6519,7 +6904,7 @@ async def test_streaming_response_update_overload_8(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6545,7 +6930,7 @@ async def test_method_update_overload_9(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6570,11 +6955,15 @@ async def test_method_update_with_all_params_overload_9(self, async_client: Asyn }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="LOC", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6587,7 +6976,7 @@ async def test_raw_response_update_overload_9(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6600,7 +6989,7 @@ async def test_streaming_response_update_overload_9(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6626,7 +7015,7 @@ async def test_method_update_overload_10(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6639,11 +7028,15 @@ async def test_method_update_with_all_params_overload_10(self, async_client: Asy name="example.com", priority=10, proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="MX", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6656,7 +7049,7 @@ async def test_raw_response_update_overload_10(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6669,7 +7062,7 @@ async def test_streaming_response_update_overload_10(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6695,7 +7088,7 @@ async def test_method_update_overload_11(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6714,11 +7107,15 @@ async def test_method_update_with_all_params_overload_11(self, async_client: Asy }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="NAPTR", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6731,7 +7128,7 @@ async def test_raw_response_update_overload_11(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6744,7 +7141,7 @@ async def test_streaming_response_update_overload_11(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6770,7 +7167,7 @@ async def test_method_update_overload_12(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6782,11 +7179,15 @@ async def test_method_update_with_all_params_overload_12(self, async_client: Asy content="ns1.example.com", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="NS", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6799,7 +7200,7 @@ async def test_raw_response_update_overload_12(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6812,7 +7213,7 @@ async def test_streaming_response_update_overload_12(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6838,7 +7239,7 @@ async def test_method_update_overload_13(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6850,11 +7251,15 @@ async def test_method_update_with_all_params_overload_13(self, async_client: Asy content="content", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="OPENPGPKEY", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6867,7 +7272,7 @@ async def test_raw_response_update_overload_13(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6880,7 +7285,7 @@ async def test_streaming_response_update_overload_13(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6906,7 +7311,7 @@ async def test_method_update_overload_14(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6918,11 +7323,15 @@ async def test_method_update_with_all_params_overload_14(self, async_client: Asy content="example.com", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="PTR", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6935,7 +7344,7 @@ async def test_raw_response_update_overload_14(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6948,7 +7357,7 @@ async def test_streaming_response_update_overload_14(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6974,7 +7383,7 @@ async def test_method_update_overload_15(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -6991,11 +7400,15 @@ async def test_method_update_with_all_params_overload_15(self, async_client: Asy }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SMIMEA", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7008,7 +7421,7 @@ async def test_raw_response_update_overload_15(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7021,7 +7434,7 @@ async def test_streaming_response_update_overload_15(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7047,7 +7460,7 @@ async def test_method_update_overload_16(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7064,11 +7477,15 @@ async def test_method_update_with_all_params_overload_16(self, async_client: Asy }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SRV", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7081,7 +7498,7 @@ async def test_raw_response_update_overload_16(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7094,7 +7511,7 @@ async def test_streaming_response_update_overload_16(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7120,7 +7537,7 @@ async def test_method_update_overload_17(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7136,11 +7553,15 @@ async def test_method_update_with_all_params_overload_17(self, async_client: Asy }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SSHFP", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7153,7 +7574,7 @@ async def test_raw_response_update_overload_17(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7166,7 +7587,7 @@ async def test_streaming_response_update_overload_17(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7192,7 +7613,7 @@ async def test_method_update_overload_18(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7208,11 +7629,15 @@ async def test_method_update_with_all_params_overload_18(self, async_client: Asy }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SVCB", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7225,7 +7650,7 @@ async def test_raw_response_update_overload_18(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7238,7 +7663,7 @@ async def test_streaming_response_update_overload_18(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7264,7 +7689,7 @@ async def test_method_update_overload_19(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7281,11 +7706,15 @@ async def test_method_update_with_all_params_overload_19(self, async_client: Asy }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="TLSA", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7298,7 +7727,7 @@ async def test_raw_response_update_overload_19(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7311,7 +7740,7 @@ async def test_streaming_response_update_overload_19(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7337,7 +7766,7 @@ async def test_method_update_overload_20(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7349,11 +7778,15 @@ async def test_method_update_with_all_params_overload_20(self, async_client: Asy content='"v=spf1 include:example.com -all"', name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="TXT", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7366,7 +7799,7 @@ async def test_raw_response_update_overload_20(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7379,7 +7812,7 @@ async def test_streaming_response_update_overload_20(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7405,7 +7838,7 @@ async def test_method_update_overload_21(self, async_client: AsyncCloudflare) -> dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7421,11 +7854,15 @@ async def test_method_update_with_all_params_overload_21(self, async_client: Asy name="example.com", priority=10, proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="URI", ) - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7438,7 +7875,7 @@ async def test_raw_response_update_overload_21(self, async_client: AsyncCloudfla assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7451,7 +7888,7 @@ async def test_streaming_response_update_overload_21(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordUpdateResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7470,13 +7907,15 @@ async def test_path_params_update_overload_21(self, async_client: AsyncCloudflar zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) + @pytest.mark.skip(reason="mock server returns invalid data") @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: record = await async_client.dns.records.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[RecordListResponse], record, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[RecordResponse], record, path=["response"]) + @pytest.mark.skip(reason="mock server returns invalid data") @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: record = await async_client.dns.records.list( @@ -7519,8 +7958,9 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) tag_match="any", type="A", ) - assert_matches_type(AsyncV4PagePaginationArray[RecordListResponse], record, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[RecordResponse], record, path=["response"]) + @pytest.mark.skip(reason="mock server returns invalid data") @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.dns.records.with_raw_response.list( @@ -7530,8 +7970,9 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[RecordListResponse], record, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[RecordResponse], record, path=["response"]) + @pytest.mark.skip(reason="mock server returns invalid data") @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: async with async_client.dns.records.with_streaming_response.list( @@ -7541,10 +7982,11 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[RecordListResponse], record, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="mock server returns invalid data") @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): @@ -7620,6 +8062,10 @@ async def test_method_batch_with_all_params(self, async_client: AsyncCloudflare) "content": "198.51.100.4", "name": "example.com", "proxied": True, + "settings": { + "ipv4_only": True, + "ipv6_only": True, + }, "tags": ["owner:dns-team"], "ttl": 3600, "type": "A", @@ -7632,6 +8078,10 @@ async def test_method_batch_with_all_params(self, async_client: AsyncCloudflare) "content": "198.51.100.4", "name": "example.com", "proxied": True, + "settings": { + "ipv4_only": True, + "ipv6_only": True, + }, "tags": ["owner:dns-team"], "ttl": 3600, "type": "A", @@ -7643,6 +8093,10 @@ async def test_method_batch_with_all_params(self, async_client: AsyncCloudflare) "content": "198.51.100.4", "name": "example.com", "proxied": True, + "settings": { + "ipv4_only": True, + "ipv6_only": True, + }, "tags": ["owner:dns-team"], "ttl": 3600, "type": "A", @@ -7693,7 +8147,7 @@ async def test_method_edit_overload_1(self, async_client: AsyncCloudflare) -> No dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7705,11 +8159,15 @@ async def test_method_edit_with_all_params_overload_1(self, async_client: AsyncC content="198.51.100.4", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="A", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7722,7 +8180,7 @@ async def test_raw_response_edit_overload_1(self, async_client: AsyncCloudflare) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7735,7 +8193,7 @@ async def test_streaming_response_edit_overload_1(self, async_client: AsyncCloud assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7761,7 +8219,7 @@ async def test_method_edit_overload_2(self, async_client: AsyncCloudflare) -> No dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7773,11 +8231,15 @@ async def test_method_edit_with_all_params_overload_2(self, async_client: AsyncC content="2400:cb00:2049::1", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="AAAA", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7790,7 +8252,7 @@ async def test_raw_response_edit_overload_2(self, async_client: AsyncCloudflare) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7803,7 +8265,7 @@ async def test_streaming_response_edit_overload_2(self, async_client: AsyncCloud assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7829,7 +8291,7 @@ async def test_method_edit_overload_3(self, async_client: AsyncCloudflare) -> No dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7845,11 +8307,15 @@ async def test_method_edit_with_all_params_overload_3(self, async_client: AsyncC }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="CAA", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7862,7 +8328,7 @@ async def test_raw_response_edit_overload_3(self, async_client: AsyncCloudflare) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7875,7 +8341,7 @@ async def test_streaming_response_edit_overload_3(self, async_client: AsyncCloud assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7901,7 +8367,7 @@ async def test_method_edit_overload_4(self, async_client: AsyncCloudflare) -> No dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7918,11 +8384,15 @@ async def test_method_edit_with_all_params_overload_4(self, async_client: AsyncC }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="CERT", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7935,7 +8405,7 @@ async def test_raw_response_edit_overload_4(self, async_client: AsyncCloudflare) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7948,7 +8418,7 @@ async def test_streaming_response_edit_overload_4(self, async_client: AsyncCloud assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7974,7 +8444,7 @@ async def test_method_edit_overload_5(self, async_client: AsyncCloudflare) -> No dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -7986,12 +8456,16 @@ async def test_method_edit_with_all_params_overload_5(self, async_client: AsyncC content="content", name="example.com", proxied=True, - settings={"flatten_cname": True}, + settings={ + "flatten_cname": True, + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="CNAME", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8004,7 +8478,7 @@ async def test_raw_response_edit_overload_5(self, async_client: AsyncCloudflare) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8017,7 +8491,7 @@ async def test_streaming_response_edit_overload_5(self, async_client: AsyncCloud assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8043,7 +8517,7 @@ async def test_method_edit_overload_6(self, async_client: AsyncCloudflare) -> No dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8060,11 +8534,15 @@ async def test_method_edit_with_all_params_overload_6(self, async_client: AsyncC }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="DNSKEY", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8077,7 +8555,7 @@ async def test_raw_response_edit_overload_6(self, async_client: AsyncCloudflare) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8090,7 +8568,7 @@ async def test_streaming_response_edit_overload_6(self, async_client: AsyncCloud assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8116,7 +8594,7 @@ async def test_method_edit_overload_7(self, async_client: AsyncCloudflare) -> No dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8133,11 +8611,15 @@ async def test_method_edit_with_all_params_overload_7(self, async_client: AsyncC }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="DS", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8150,7 +8632,7 @@ async def test_raw_response_edit_overload_7(self, async_client: AsyncCloudflare) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8163,7 +8645,7 @@ async def test_streaming_response_edit_overload_7(self, async_client: AsyncCloud assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8189,7 +8671,7 @@ async def test_method_edit_overload_8(self, async_client: AsyncCloudflare) -> No dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8205,11 +8687,15 @@ async def test_method_edit_with_all_params_overload_8(self, async_client: AsyncC }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="HTTPS", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8222,7 +8708,7 @@ async def test_raw_response_edit_overload_8(self, async_client: AsyncCloudflare) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8235,7 +8721,7 @@ async def test_streaming_response_edit_overload_8(self, async_client: AsyncCloud assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8261,7 +8747,7 @@ async def test_method_edit_overload_9(self, async_client: AsyncCloudflare) -> No dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8286,11 +8772,15 @@ async def test_method_edit_with_all_params_overload_9(self, async_client: AsyncC }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="LOC", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8303,7 +8793,7 @@ async def test_raw_response_edit_overload_9(self, async_client: AsyncCloudflare) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8316,7 +8806,7 @@ async def test_streaming_response_edit_overload_9(self, async_client: AsyncCloud assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8342,7 +8832,7 @@ async def test_method_edit_overload_10(self, async_client: AsyncCloudflare) -> N dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8355,11 +8845,15 @@ async def test_method_edit_with_all_params_overload_10(self, async_client: Async name="example.com", priority=10, proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="MX", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8372,7 +8866,7 @@ async def test_raw_response_edit_overload_10(self, async_client: AsyncCloudflare assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8385,7 +8879,7 @@ async def test_streaming_response_edit_overload_10(self, async_client: AsyncClou assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8411,7 +8905,7 @@ async def test_method_edit_overload_11(self, async_client: AsyncCloudflare) -> N dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8430,11 +8924,15 @@ async def test_method_edit_with_all_params_overload_11(self, async_client: Async }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="NAPTR", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8447,7 +8945,7 @@ async def test_raw_response_edit_overload_11(self, async_client: AsyncCloudflare assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8460,7 +8958,7 @@ async def test_streaming_response_edit_overload_11(self, async_client: AsyncClou assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8486,7 +8984,7 @@ async def test_method_edit_overload_12(self, async_client: AsyncCloudflare) -> N dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8498,11 +8996,15 @@ async def test_method_edit_with_all_params_overload_12(self, async_client: Async content="ns1.example.com", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="NS", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8515,7 +9017,7 @@ async def test_raw_response_edit_overload_12(self, async_client: AsyncCloudflare assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8528,7 +9030,7 @@ async def test_streaming_response_edit_overload_12(self, async_client: AsyncClou assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8554,7 +9056,7 @@ async def test_method_edit_overload_13(self, async_client: AsyncCloudflare) -> N dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8566,11 +9068,15 @@ async def test_method_edit_with_all_params_overload_13(self, async_client: Async content="content", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="OPENPGPKEY", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8583,7 +9089,7 @@ async def test_raw_response_edit_overload_13(self, async_client: AsyncCloudflare assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8596,7 +9102,7 @@ async def test_streaming_response_edit_overload_13(self, async_client: AsyncClou assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8622,7 +9128,7 @@ async def test_method_edit_overload_14(self, async_client: AsyncCloudflare) -> N dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8634,11 +9140,15 @@ async def test_method_edit_with_all_params_overload_14(self, async_client: Async content="example.com", name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="PTR", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8651,7 +9161,7 @@ async def test_raw_response_edit_overload_14(self, async_client: AsyncCloudflare assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8664,7 +9174,7 @@ async def test_streaming_response_edit_overload_14(self, async_client: AsyncClou assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8690,7 +9200,7 @@ async def test_method_edit_overload_15(self, async_client: AsyncCloudflare) -> N dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8707,11 +9217,15 @@ async def test_method_edit_with_all_params_overload_15(self, async_client: Async }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SMIMEA", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8724,7 +9238,7 @@ async def test_raw_response_edit_overload_15(self, async_client: AsyncCloudflare assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8737,7 +9251,7 @@ async def test_streaming_response_edit_overload_15(self, async_client: AsyncClou assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8763,7 +9277,7 @@ async def test_method_edit_overload_16(self, async_client: AsyncCloudflare) -> N dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8780,11 +9294,15 @@ async def test_method_edit_with_all_params_overload_16(self, async_client: Async }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SRV", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8797,7 +9315,7 @@ async def test_raw_response_edit_overload_16(self, async_client: AsyncCloudflare assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8810,7 +9328,7 @@ async def test_streaming_response_edit_overload_16(self, async_client: AsyncClou assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8836,7 +9354,7 @@ async def test_method_edit_overload_17(self, async_client: AsyncCloudflare) -> N dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8852,11 +9370,15 @@ async def test_method_edit_with_all_params_overload_17(self, async_client: Async }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SSHFP", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8869,7 +9391,7 @@ async def test_raw_response_edit_overload_17(self, async_client: AsyncCloudflare assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8882,7 +9404,7 @@ async def test_streaming_response_edit_overload_17(self, async_client: AsyncClou assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8908,7 +9430,7 @@ async def test_method_edit_overload_18(self, async_client: AsyncCloudflare) -> N dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8924,11 +9446,15 @@ async def test_method_edit_with_all_params_overload_18(self, async_client: Async }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="SVCB", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8941,7 +9467,7 @@ async def test_raw_response_edit_overload_18(self, async_client: AsyncCloudflare assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8954,7 +9480,7 @@ async def test_streaming_response_edit_overload_18(self, async_client: AsyncClou assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8980,7 +9506,7 @@ async def test_method_edit_overload_19(self, async_client: AsyncCloudflare) -> N dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -8997,11 +9523,15 @@ async def test_method_edit_with_all_params_overload_19(self, async_client: Async }, name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="TLSA", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -9014,7 +9544,7 @@ async def test_raw_response_edit_overload_19(self, async_client: AsyncCloudflare assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -9027,7 +9557,7 @@ async def test_streaming_response_edit_overload_19(self, async_client: AsyncClou assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -9053,7 +9583,7 @@ async def test_method_edit_overload_20(self, async_client: AsyncCloudflare) -> N dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -9065,11 +9595,15 @@ async def test_method_edit_with_all_params_overload_20(self, async_client: Async content='"v=spf1 include:example.com -all"', name="example.com", proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="TXT", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -9082,7 +9616,7 @@ async def test_raw_response_edit_overload_20(self, async_client: AsyncCloudflare assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -9095,7 +9629,7 @@ async def test_streaming_response_edit_overload_20(self, async_client: AsyncClou assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -9121,7 +9655,7 @@ async def test_method_edit_overload_21(self, async_client: AsyncCloudflare) -> N dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -9137,11 +9671,15 @@ async def test_method_edit_with_all_params_overload_21(self, async_client: Async name="example.com", priority=10, proxied=True, + settings={ + "ipv4_only": True, + "ipv6_only": True, + }, tags=["owner:dns-team"], ttl=3600, type="URI", ) - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -9154,7 +9692,7 @@ async def test_raw_response_edit_overload_21(self, async_client: AsyncCloudflare assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -9167,7 +9705,7 @@ async def test_streaming_response_edit_overload_21(self, async_client: AsyncClou assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordEditResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -9224,14 +9762,16 @@ async def test_path_params_export(self, async_client: AsyncCloudflare) -> None: zone_id="", ) + @pytest.mark.skip(reason="mock server returns invalid data") @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: record = await async_client.dns.records.get( dns_record_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RecordGetResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) + @pytest.mark.skip(reason="mock server returns invalid data") @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.dns.records.with_raw_response.get( @@ -9242,8 +9782,9 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordGetResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) + @pytest.mark.skip(reason="mock server returns invalid data") @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.dns.records.with_streaming_response.get( @@ -9254,10 +9795,11 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(Optional[RecordGetResponse], record, path=["response"]) + assert_matches_type(Optional[RecordResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="mock server returns invalid data") @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): diff --git a/tests/api_resources/email_security/settings/test_block_senders.py b/tests/api_resources/email_security/settings/test_block_senders.py index 27fc016dbbe..e6bb0a56223 100644 --- a/tests/api_resources/email_security/settings/test_block_senders.py +++ b/tests/api_resources/email_security/settings/test_block_senders.py @@ -25,7 +25,7 @@ class TestBlockSenders: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_create_overload_1(self, client: Cloudflare) -> None: + def test_method_create(self, client: Cloudflare) -> None: block_sender = client.email_security.settings.block_senders.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", is_regex=False, @@ -35,7 +35,7 @@ def test_method_create_overload_1(self, client: Cloudflare) -> None: assert_matches_type(BlockSenderCreateResponse, block_sender, path=["response"]) @parametrize - def test_method_create_with_all_params_overload_1(self, client: Cloudflare) -> None: + def test_method_create_with_all_params(self, client: Cloudflare) -> None: block_sender = client.email_security.settings.block_senders.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", is_regex=False, @@ -46,7 +46,7 @@ def test_method_create_with_all_params_overload_1(self, client: Cloudflare) -> N assert_matches_type(BlockSenderCreateResponse, block_sender, path=["response"]) @parametrize - def test_raw_response_create_overload_1(self, client: Cloudflare) -> None: + def test_raw_response_create(self, client: Cloudflare) -> None: response = client.email_security.settings.block_senders.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", is_regex=False, @@ -60,7 +60,7 @@ def test_raw_response_create_overload_1(self, client: Cloudflare) -> None: assert_matches_type(BlockSenderCreateResponse, block_sender, path=["response"]) @parametrize - def test_streaming_response_create_overload_1(self, client: Cloudflare) -> None: + def test_streaming_response_create(self, client: Cloudflare) -> None: with client.email_security.settings.block_senders.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", is_regex=False, @@ -76,7 +76,7 @@ def test_streaming_response_create_overload_1(self, client: Cloudflare) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_create_overload_1(self, client: Cloudflare) -> None: + 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.email_security.settings.block_senders.with_raw_response.create( account_id="", @@ -85,72 +85,6 @@ def test_path_params_create_overload_1(self, client: Cloudflare) -> None: pattern_type="EMAIL", ) - @parametrize - def test_method_create_overload_2(self, client: Cloudflare) -> None: - block_sender = client.email_security.settings.block_senders.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "is_regex": False, - "pattern": "test@example.com", - "pattern_type": "EMAIL", - } - ], - ) - assert_matches_type(BlockSenderCreateResponse, block_sender, path=["response"]) - - @parametrize - def test_raw_response_create_overload_2(self, client: Cloudflare) -> None: - response = client.email_security.settings.block_senders.with_raw_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "is_regex": False, - "pattern": "test@example.com", - "pattern_type": "EMAIL", - } - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - block_sender = response.parse() - assert_matches_type(BlockSenderCreateResponse, block_sender, path=["response"]) - - @parametrize - def test_streaming_response_create_overload_2(self, client: Cloudflare) -> None: - with client.email_security.settings.block_senders.with_streaming_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "is_regex": False, - "pattern": "test@example.com", - "pattern_type": "EMAIL", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - block_sender = response.parse() - assert_matches_type(BlockSenderCreateResponse, block_sender, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create_overload_2(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.email_security.settings.block_senders.with_raw_response.create( - account_id="", - body=[ - { - "is_regex": False, - "pattern": "test@example.com", - "pattern_type": "EMAIL", - } - ], - ) - @parametrize def test_method_list(self, client: Cloudflare) -> None: block_sender = client.email_security.settings.block_senders.list( @@ -345,7 +279,7 @@ class TestAsyncBlockSenders: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_method_create(self, async_client: AsyncCloudflare) -> None: block_sender = await async_client.email_security.settings.block_senders.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", is_regex=False, @@ -355,7 +289,7 @@ async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> assert_matches_type(BlockSenderCreateResponse, block_sender, path=["response"]) @parametrize - async def test_method_create_with_all_params_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: block_sender = await async_client.email_security.settings.block_senders.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", is_regex=False, @@ -366,7 +300,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn assert_matches_type(BlockSenderCreateResponse, block_sender, path=["response"]) @parametrize - async def test_raw_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.email_security.settings.block_senders.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", is_regex=False, @@ -380,7 +314,7 @@ async def test_raw_response_create_overload_1(self, async_client: AsyncCloudflar assert_matches_type(BlockSenderCreateResponse, block_sender, path=["response"]) @parametrize - async def test_streaming_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.email_security.settings.block_senders.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", is_regex=False, @@ -396,7 +330,7 @@ async def test_streaming_response_create_overload_1(self, async_client: AsyncClo assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_create_overload_1(self, async_client: AsyncCloudflare) -> None: + 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.email_security.settings.block_senders.with_raw_response.create( account_id="", @@ -405,72 +339,6 @@ async def test_path_params_create_overload_1(self, async_client: AsyncCloudflare pattern_type="EMAIL", ) - @parametrize - async def test_method_create_overload_2(self, async_client: AsyncCloudflare) -> None: - block_sender = await async_client.email_security.settings.block_senders.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "is_regex": False, - "pattern": "test@example.com", - "pattern_type": "EMAIL", - } - ], - ) - assert_matches_type(BlockSenderCreateResponse, block_sender, path=["response"]) - - @parametrize - async def test_raw_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: - response = await async_client.email_security.settings.block_senders.with_raw_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "is_regex": False, - "pattern": "test@example.com", - "pattern_type": "EMAIL", - } - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - block_sender = await response.parse() - assert_matches_type(BlockSenderCreateResponse, block_sender, path=["response"]) - - @parametrize - async def test_streaming_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: - async with async_client.email_security.settings.block_senders.with_streaming_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "is_regex": False, - "pattern": "test@example.com", - "pattern_type": "EMAIL", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - block_sender = await response.parse() - assert_matches_type(BlockSenderCreateResponse, block_sender, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create_overload_2(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.email_security.settings.block_senders.with_raw_response.create( - account_id="", - body=[ - { - "is_regex": False, - "pattern": "test@example.com", - "pattern_type": "EMAIL", - } - ], - ) - @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: block_sender = await async_client.email_security.settings.block_senders.list( diff --git a/tests/api_resources/email_security/settings/test_impersonation_registry.py b/tests/api_resources/email_security/settings/test_impersonation_registry.py index 8a4ad4fbe92..166def7dd1e 100644 --- a/tests/api_resources/email_security/settings/test_impersonation_registry.py +++ b/tests/api_resources/email_security/settings/test_impersonation_registry.py @@ -25,7 +25,7 @@ class TestImpersonationRegistry: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_create_overload_1(self, client: Cloudflare) -> None: + def test_method_create(self, client: Cloudflare) -> None: impersonation_registry = client.email_security.settings.impersonation_registry.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", email="email", @@ -35,7 +35,7 @@ def test_method_create_overload_1(self, client: Cloudflare) -> None: assert_matches_type(ImpersonationRegistryCreateResponse, impersonation_registry, path=["response"]) @parametrize - def test_raw_response_create_overload_1(self, client: Cloudflare) -> None: + def test_raw_response_create(self, client: Cloudflare) -> None: response = client.email_security.settings.impersonation_registry.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", email="email", @@ -49,7 +49,7 @@ def test_raw_response_create_overload_1(self, client: Cloudflare) -> None: assert_matches_type(ImpersonationRegistryCreateResponse, impersonation_registry, path=["response"]) @parametrize - def test_streaming_response_create_overload_1(self, client: Cloudflare) -> None: + def test_streaming_response_create(self, client: Cloudflare) -> None: with client.email_security.settings.impersonation_registry.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", email="email", @@ -65,7 +65,7 @@ def test_streaming_response_create_overload_1(self, client: Cloudflare) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_create_overload_1(self, client: Cloudflare) -> None: + 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.email_security.settings.impersonation_registry.with_raw_response.create( account_id="", @@ -74,72 +74,6 @@ def test_path_params_create_overload_1(self, client: Cloudflare) -> None: name="name", ) - @parametrize - def test_method_create_overload_2(self, client: Cloudflare) -> None: - impersonation_registry = client.email_security.settings.impersonation_registry.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "email": "email", - "is_email_regex": True, - "name": "name", - } - ], - ) - assert_matches_type(ImpersonationRegistryCreateResponse, impersonation_registry, path=["response"]) - - @parametrize - def test_raw_response_create_overload_2(self, client: Cloudflare) -> None: - response = client.email_security.settings.impersonation_registry.with_raw_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "email": "email", - "is_email_regex": True, - "name": "name", - } - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - impersonation_registry = response.parse() - assert_matches_type(ImpersonationRegistryCreateResponse, impersonation_registry, path=["response"]) - - @parametrize - def test_streaming_response_create_overload_2(self, client: Cloudflare) -> None: - with client.email_security.settings.impersonation_registry.with_streaming_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "email": "email", - "is_email_regex": True, - "name": "name", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - impersonation_registry = response.parse() - assert_matches_type(ImpersonationRegistryCreateResponse, impersonation_registry, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create_overload_2(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.email_security.settings.impersonation_registry.with_raw_response.create( - account_id="", - body=[ - { - "email": "email", - "is_email_regex": True, - "name": "name", - } - ], - ) - @parametrize def test_method_list(self, client: Cloudflare) -> None: impersonation_registry = client.email_security.settings.impersonation_registry.list( @@ -341,7 +275,7 @@ class TestAsyncImpersonationRegistry: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_method_create(self, async_client: AsyncCloudflare) -> None: impersonation_registry = await async_client.email_security.settings.impersonation_registry.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", email="email", @@ -351,7 +285,7 @@ async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> assert_matches_type(ImpersonationRegistryCreateResponse, impersonation_registry, path=["response"]) @parametrize - async def test_raw_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.email_security.settings.impersonation_registry.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", email="email", @@ -365,7 +299,7 @@ async def test_raw_response_create_overload_1(self, async_client: AsyncCloudflar assert_matches_type(ImpersonationRegistryCreateResponse, impersonation_registry, path=["response"]) @parametrize - async def test_streaming_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.email_security.settings.impersonation_registry.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", email="email", @@ -381,7 +315,7 @@ async def test_streaming_response_create_overload_1(self, async_client: AsyncClo assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_create_overload_1(self, async_client: AsyncCloudflare) -> None: + 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.email_security.settings.impersonation_registry.with_raw_response.create( account_id="", @@ -390,72 +324,6 @@ async def test_path_params_create_overload_1(self, async_client: AsyncCloudflare name="name", ) - @parametrize - async def test_method_create_overload_2(self, async_client: AsyncCloudflare) -> None: - impersonation_registry = await async_client.email_security.settings.impersonation_registry.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "email": "email", - "is_email_regex": True, - "name": "name", - } - ], - ) - assert_matches_type(ImpersonationRegistryCreateResponse, impersonation_registry, path=["response"]) - - @parametrize - async def test_raw_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: - response = await async_client.email_security.settings.impersonation_registry.with_raw_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "email": "email", - "is_email_regex": True, - "name": "name", - } - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - impersonation_registry = await response.parse() - assert_matches_type(ImpersonationRegistryCreateResponse, impersonation_registry, path=["response"]) - - @parametrize - async def test_streaming_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: - async with async_client.email_security.settings.impersonation_registry.with_streaming_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "email": "email", - "is_email_regex": True, - "name": "name", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - impersonation_registry = await response.parse() - assert_matches_type(ImpersonationRegistryCreateResponse, impersonation_registry, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create_overload_2(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.email_security.settings.impersonation_registry.with_raw_response.create( - account_id="", - body=[ - { - "email": "email", - "is_email_regex": True, - "name": "name", - } - ], - ) - @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: impersonation_registry = await async_client.email_security.settings.impersonation_registry.list( diff --git a/tests/api_resources/email_security/settings/test_trusted_domains.py b/tests/api_resources/email_security/settings/test_trusted_domains.py index 643f33b595d..33d602bb1a4 100644 --- a/tests/api_resources/email_security/settings/test_trusted_domains.py +++ b/tests/api_resources/email_security/settings/test_trusted_domains.py @@ -24,6 +24,7 @@ class TestTrustedDomains: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_method_create_overload_1(self, client: Cloudflare) -> None: trusted_domain = client.email_security.settings.trusted_domains.create( @@ -35,6 +36,7 @@ def test_method_create_overload_1(self, client: Cloudflare) -> None: ) assert_matches_type(TrustedDomainCreateResponse, trusted_domain, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_method_create_with_all_params_overload_1(self, client: Cloudflare) -> None: trusted_domain = client.email_security.settings.trusted_domains.create( @@ -47,6 +49,7 @@ def test_method_create_with_all_params_overload_1(self, client: Cloudflare) -> N ) assert_matches_type(TrustedDomainCreateResponse, trusted_domain, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_raw_response_create_overload_1(self, client: Cloudflare) -> None: response = client.email_security.settings.trusted_domains.with_raw_response.create( @@ -62,6 +65,7 @@ def test_raw_response_create_overload_1(self, client: Cloudflare) -> None: trusted_domain = response.parse() assert_matches_type(TrustedDomainCreateResponse, trusted_domain, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_streaming_response_create_overload_1(self, client: Cloudflare) -> None: with client.email_security.settings.trusted_domains.with_streaming_response.create( @@ -79,6 +83,7 @@ def test_streaming_response_create_overload_1(self, client: Cloudflare) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_path_params_create_overload_1(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): @@ -90,6 +95,7 @@ def test_path_params_create_overload_1(self, client: Cloudflare) -> None: pattern="example.com", ) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_method_create_overload_2(self, client: Cloudflare) -> None: trusted_domain = client.email_security.settings.trusted_domains.create( @@ -105,6 +111,7 @@ def test_method_create_overload_2(self, client: Cloudflare) -> None: ) assert_matches_type(TrustedDomainCreateResponse, trusted_domain, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_raw_response_create_overload_2(self, client: Cloudflare) -> None: response = client.email_security.settings.trusted_domains.with_raw_response.create( @@ -124,6 +131,7 @@ def test_raw_response_create_overload_2(self, client: Cloudflare) -> None: trusted_domain = response.parse() assert_matches_type(TrustedDomainCreateResponse, trusted_domain, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_streaming_response_create_overload_2(self, client: Cloudflare) -> None: with client.email_security.settings.trusted_domains.with_streaming_response.create( @@ -145,6 +153,7 @@ def test_streaming_response_create_overload_2(self, client: Cloudflare) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_path_params_create_overload_2(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): @@ -355,6 +364,7 @@ def test_path_params_get(self, client: Cloudflare) -> None: class TestAsyncTrustedDomains: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> None: trusted_domain = await async_client.email_security.settings.trusted_domains.create( @@ -366,6 +376,7 @@ async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> ) assert_matches_type(TrustedDomainCreateResponse, trusted_domain, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_method_create_with_all_params_overload_1(self, async_client: AsyncCloudflare) -> None: trusted_domain = await async_client.email_security.settings.trusted_domains.create( @@ -378,6 +389,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn ) assert_matches_type(TrustedDomainCreateResponse, trusted_domain, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_raw_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: response = await async_client.email_security.settings.trusted_domains.with_raw_response.create( @@ -393,6 +405,7 @@ async def test_raw_response_create_overload_1(self, async_client: AsyncCloudflar trusted_domain = await response.parse() assert_matches_type(TrustedDomainCreateResponse, trusted_domain, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_streaming_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: async with async_client.email_security.settings.trusted_domains.with_streaming_response.create( @@ -410,6 +423,7 @@ async def test_streaming_response_create_overload_1(self, async_client: AsyncClo assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_path_params_create_overload_1(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): @@ -421,6 +435,7 @@ async def test_path_params_create_overload_1(self, async_client: AsyncCloudflare pattern="example.com", ) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_method_create_overload_2(self, async_client: AsyncCloudflare) -> None: trusted_domain = await async_client.email_security.settings.trusted_domains.create( @@ -436,6 +451,7 @@ async def test_method_create_overload_2(self, async_client: AsyncCloudflare) -> ) assert_matches_type(TrustedDomainCreateResponse, trusted_domain, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_raw_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: response = await async_client.email_security.settings.trusted_domains.with_raw_response.create( @@ -455,6 +471,7 @@ async def test_raw_response_create_overload_2(self, async_client: AsyncCloudflar trusted_domain = await response.parse() assert_matches_type(TrustedDomainCreateResponse, trusted_domain, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_streaming_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: async with async_client.email_security.settings.trusted_domains.with_streaming_response.create( @@ -476,6 +493,7 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncClo assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_path_params_create_overload_2(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): diff --git a/tests/api_resources/logpush/test_jobs.py b/tests/api_resources/logpush/test_jobs.py index a35edd8c19e..0674d1ec883 100644 --- a/tests/api_resources/logpush/test_jobs.py +++ b/tests/api_resources/logpush/test_jobs.py @@ -126,6 +126,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: max_upload_bytes=5000000, max_upload_interval_seconds=30, max_upload_records=1000, + name="example.com", output_options={ "batch_prefix": "batch_prefix", "batch_suffix": "batch_suffix", @@ -476,6 +477,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare max_upload_bytes=5000000, max_upload_interval_seconds=30, max_upload_records=1000, + name="example.com", output_options={ "batch_prefix": "batch_prefix", "batch_suffix": "batch_suffix", diff --git a/tests/api_resources/logpush/test_validate.py b/tests/api_resources/logpush/test_validate.py index fd2a12df619..3a7d1dbf97c 100644 --- a/tests/api_resources/logpush/test_validate.py +++ b/tests/api_resources/logpush/test_validate.py @@ -12,6 +12,7 @@ from cloudflare.types.logpush import ( ValidateOriginResponse, ValidateDestinationResponse, + ValidateDestinationExistsResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -81,6 +82,67 @@ def test_path_params_destination(self, client: Cloudflare) -> None: account_id="account_id", ) + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_destination_exists(self, client: Cloudflare) -> None: + validate = client.logpush.validate.destination_exists( + destination_conf="s3://mybucket/logs?region=us-west-2", + account_id="account_id", + ) + assert_matches_type(Optional[ValidateDestinationExistsResponse], validate, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_destination_exists_with_all_params(self, client: Cloudflare) -> None: + validate = client.logpush.validate.destination_exists( + destination_conf="s3://mybucket/logs?region=us-west-2", + account_id="account_id", + ) + assert_matches_type(Optional[ValidateDestinationExistsResponse], validate, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_raw_response_destination_exists(self, client: Cloudflare) -> None: + response = client.logpush.validate.with_raw_response.destination_exists( + destination_conf="s3://mybucket/logs?region=us-west-2", + account_id="account_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + validate = response.parse() + assert_matches_type(Optional[ValidateDestinationExistsResponse], validate, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_streaming_response_destination_exists(self, client: Cloudflare) -> None: + with client.logpush.validate.with_streaming_response.destination_exists( + destination_conf="s3://mybucket/logs?region=us-west-2", + account_id="account_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + validate = response.parse() + assert_matches_type(Optional[ValidateDestinationExistsResponse], validate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_path_params_destination_exists(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.logpush.validate.with_raw_response.destination_exists( + destination_conf="s3://mybucket/logs?region=us-west-2", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.logpush.validate.with_raw_response.destination_exists( + destination_conf="s3://mybucket/logs?region=us-west-2", + account_id="account_id", + ) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_origin(self, client: Cloudflare) -> None: @@ -207,6 +269,67 @@ async def test_path_params_destination(self, async_client: AsyncCloudflare) -> N account_id="account_id", ) + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_destination_exists(self, async_client: AsyncCloudflare) -> None: + validate = await async_client.logpush.validate.destination_exists( + destination_conf="s3://mybucket/logs?region=us-west-2", + account_id="account_id", + ) + assert_matches_type(Optional[ValidateDestinationExistsResponse], validate, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_destination_exists_with_all_params(self, async_client: AsyncCloudflare) -> None: + validate = await async_client.logpush.validate.destination_exists( + destination_conf="s3://mybucket/logs?region=us-west-2", + account_id="account_id", + ) + assert_matches_type(Optional[ValidateDestinationExistsResponse], validate, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_raw_response_destination_exists(self, async_client: AsyncCloudflare) -> None: + response = await async_client.logpush.validate.with_raw_response.destination_exists( + destination_conf="s3://mybucket/logs?region=us-west-2", + account_id="account_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + validate = await response.parse() + assert_matches_type(Optional[ValidateDestinationExistsResponse], validate, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_streaming_response_destination_exists(self, async_client: AsyncCloudflare) -> None: + async with async_client.logpush.validate.with_streaming_response.destination_exists( + destination_conf="s3://mybucket/logs?region=us-west-2", + account_id="account_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + validate = await response.parse() + assert_matches_type(Optional[ValidateDestinationExistsResponse], validate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_path_params_destination_exists(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.logpush.validate.with_raw_response.destination_exists( + destination_conf="s3://mybucket/logs?region=us-west-2", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.logpush.validate.with_raw_response.destination_exists( + destination_conf="s3://mybucket/logs?region=us-west-2", + account_id="account_id", + ) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_origin(self, async_client: AsyncCloudflare) -> None: diff --git a/tests/api_resources/magic_transit/sites/test_acls.py b/tests/api_resources/magic_transit/sites/test_acls.py index e14f6ccb449..151e289d692 100644 --- a/tests/api_resources/magic_transit/sites/test_acls.py +++ b/tests/api_resources/magic_transit/sites/test_acls.py @@ -52,6 +52,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: description="Allows local traffic between PIN pads and cash register.", forward_locally=True, protocols=["tcp"], + unidirectional=True, ) assert_matches_type(ACL, acl, path=["response"]) @@ -138,6 +139,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: }, name="PIN Pad - Cash Register", protocols=["tcp"], + unidirectional=True, ) assert_matches_type(ACL, acl, path=["response"]) @@ -331,6 +333,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: }, name="PIN Pad - Cash Register", protocols=["tcp"], + unidirectional=True, ) assert_matches_type(ACL, acl, path=["response"]) @@ -481,6 +484,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare description="Allows local traffic between PIN pads and cash register.", forward_locally=True, protocols=["tcp"], + unidirectional=True, ) assert_matches_type(ACL, acl, path=["response"]) @@ -567,6 +571,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare }, name="PIN Pad - Cash Register", protocols=["tcp"], + unidirectional=True, ) assert_matches_type(ACL, acl, path=["response"]) @@ -760,6 +765,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) }, name="PIN Pad - Cash Register", protocols=["tcp"], + unidirectional=True, ) assert_matches_type(ACL, acl, path=["response"]) diff --git a/tests/api_resources/r2/buckets/domains/test_custom.py b/tests/api_resources/r2/buckets/domains/test_custom.py index 3770f95c3f3..87e7d3ccb1f 100644 --- a/tests/api_resources/r2/buckets/domains/test_custom.py +++ b/tests/api_resources/r2/buckets/domains/test_custom.py @@ -45,7 +45,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: enabled=True, zone_id="36ca64a6d92827b8a6b90be344bb1bfd", min_tls="1.0", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(CustomCreateResponse, custom, path=["response"]) @@ -123,7 +123,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: bucket_name="example-bucket", enabled=True, min_tls="1.0", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(CustomUpdateResponse, custom, path=["response"]) @@ -196,7 +196,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: custom = client.r2.buckets.domains.custom.list( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(CustomListResponse, custom, path=["response"]) @@ -260,7 +260,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: domain_name="example-domain/custom-domain.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", bucket_name="example-bucket", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(CustomDeleteResponse, custom, path=["response"]) @@ -335,7 +335,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: domain_name="example-domain/custom-domain.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", bucket_name="example-bucket", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(CustomGetResponse, custom, path=["response"]) @@ -419,7 +419,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare enabled=True, zone_id="36ca64a6d92827b8a6b90be344bb1bfd", min_tls="1.0", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(CustomCreateResponse, custom, path=["response"]) @@ -497,7 +497,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare bucket_name="example-bucket", enabled=True, min_tls="1.0", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(CustomUpdateResponse, custom, path=["response"]) @@ -570,7 +570,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) custom = await async_client.r2.buckets.domains.custom.list( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(CustomListResponse, custom, path=["response"]) @@ -634,7 +634,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare domain_name="example-domain/custom-domain.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", bucket_name="example-bucket", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(CustomDeleteResponse, custom, path=["response"]) @@ -709,7 +709,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - domain_name="example-domain/custom-domain.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", bucket_name="example-bucket", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(CustomGetResponse, custom, path=["response"]) diff --git a/tests/api_resources/r2/buckets/domains/test_managed.py b/tests/api_resources/r2/buckets/domains/test_managed.py index a1c8f3bc5b0..2d574c1b72a 100644 --- a/tests/api_resources/r2/buckets/domains/test_managed.py +++ b/tests/api_resources/r2/buckets/domains/test_managed.py @@ -34,7 +34,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", enabled=True, - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(ManagedUpdateResponse, managed, path=["response"]) @@ -100,7 +100,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: managed = client.r2.buckets.domains.managed.list( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(ManagedListResponse, managed, path=["response"]) @@ -168,7 +168,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", enabled=True, - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(ManagedUpdateResponse, managed, path=["response"]) @@ -234,7 +234,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) managed = await async_client.r2.buckets.domains.managed.list( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(ManagedListResponse, managed, path=["response"]) diff --git a/tests/api_resources/r2/buckets/event_notifications/configuration/test_queues.py b/tests/api_resources/r2/buckets/event_notifications/configuration/test_queues.py index 870412e34cc..8a8fa2a2102 100644 --- a/tests/api_resources/r2/buckets/event_notifications/configuration/test_queues.py +++ b/tests/api_resources/r2/buckets/event_notifications/configuration/test_queues.py @@ -41,7 +41,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "suffix": ".jpeg", } ], - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(object, queue, path=["response"]) @@ -116,7 +116,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: queue_id="queue_id", account_id="023e105f4ecef8ad9ca31a8372d0c353", bucket_name="example-bucket", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(object, queue, path=["response"]) @@ -203,7 +203,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "suffix": ".jpeg", } ], - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(object, queue, path=["response"]) @@ -278,7 +278,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare queue_id="queue_id", account_id="023e105f4ecef8ad9ca31a8372d0c353", bucket_name="example-bucket", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(object, queue, path=["response"]) diff --git a/tests/api_resources/r2/buckets/event_notifications/test_configuration.py b/tests/api_resources/r2/buckets/event_notifications/test_configuration.py index beb978137e8..48c14e93942 100644 --- a/tests/api_resources/r2/buckets/event_notifications/test_configuration.py +++ b/tests/api_resources/r2/buckets/event_notifications/test_configuration.py @@ -32,7 +32,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: configuration = client.r2.buckets.event_notifications.configuration.get( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(ConfigurationGetResponse, configuration, path=["response"]) @@ -98,7 +98,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - configuration = await async_client.r2.buckets.event_notifications.configuration.get( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(ConfigurationGetResponse, configuration, path=["response"]) diff --git a/tests/api_resources/r2/buckets/test_cors.py b/tests/api_resources/r2/buckets/test_cors.py index c64f885d196..4c978af07d5 100644 --- a/tests/api_resources/r2/buckets/test_cors.py +++ b/tests/api_resources/r2/buckets/test_cors.py @@ -44,7 +44,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "max_age_seconds": 3600, } ], - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(object, cors, path=["response"]) @@ -106,7 +106,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: cors = client.r2.buckets.cors.delete( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(object, cors, path=["response"]) @@ -168,7 +168,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: cors = client.r2.buckets.cors.get( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(CORSGetResponse, cors, path=["response"]) @@ -246,7 +246,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "max_age_seconds": 3600, } ], - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(object, cors, path=["response"]) @@ -308,7 +308,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare cors = await async_client.r2.buckets.cors.delete( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(object, cors, path=["response"]) @@ -370,7 +370,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - cors = await async_client.r2.buckets.cors.get( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(CORSGetResponse, cors, path=["response"]) diff --git a/tests/api_resources/r2/buckets/test_lifecycle.py b/tests/api_resources/r2/buckets/test_lifecycle.py index a8d7d965613..f377344330f 100644 --- a/tests/api_resources/r2/buckets/test_lifecycle.py +++ b/tests/api_resources/r2/buckets/test_lifecycle.py @@ -60,7 +60,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: ], } ], - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(object, lifecycle, path=["response"]) @@ -122,7 +122,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: lifecycle = client.r2.buckets.lifecycle.get( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(LifecycleGetResponse, lifecycle, path=["response"]) @@ -216,7 +216,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare ], } ], - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(object, lifecycle, path=["response"]) @@ -278,7 +278,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - lifecycle = await async_client.r2.buckets.lifecycle.get( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(LifecycleGetResponse, lifecycle, path=["response"]) diff --git a/tests/api_resources/r2/buckets/test_sippy.py b/tests/api_resources/r2/buckets/test_sippy.py index 3fdc3bec704..6e67aca418d 100644 --- a/tests/api_resources/r2/buckets/test_sippy.py +++ b/tests/api_resources/r2/buckets/test_sippy.py @@ -44,7 +44,7 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N "region": "region", "secret_access_key": "secretAccessKey", }, - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(Sippy, sippy, path=["response"]) @@ -117,7 +117,7 @@ def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> N "private_key": "privateKey", "provider": "gcs", }, - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(Sippy, sippy, path=["response"]) @@ -179,7 +179,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: sippy = client.r2.buckets.sippy.delete( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(SippyDeleteResponse, sippy, path=["response"]) @@ -241,7 +241,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: sippy = client.r2.buckets.sippy.get( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(Sippy, sippy, path=["response"]) @@ -319,7 +319,7 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn "region": "region", "secret_access_key": "secretAccessKey", }, - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(Sippy, sippy, path=["response"]) @@ -392,7 +392,7 @@ async def test_method_update_with_all_params_overload_2(self, async_client: Asyn "private_key": "privateKey", "provider": "gcs", }, - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(Sippy, sippy, path=["response"]) @@ -454,7 +454,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare sippy = await async_client.r2.buckets.sippy.delete( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(SippyDeleteResponse, sippy, path=["response"]) @@ -516,7 +516,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - sippy = await async_client.r2.buckets.sippy.get( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(Sippy, sippy, path=["response"]) diff --git a/tests/api_resources/r2/test_buckets.py b/tests/api_resources/r2/test_buckets.py index e1713e18824..78d22d35f70 100644 --- a/tests/api_resources/r2/test_buckets.py +++ b/tests/api_resources/r2/test_buckets.py @@ -34,7 +34,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: name="example-bucket", location_hint="apac", storage_class="Standard", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(Bucket, bucket, path=["response"]) @@ -94,7 +94,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: order="name", per_page=1, start_after="my-bucket", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(BucketListResponse, bucket, path=["response"]) @@ -147,7 +147,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: bucket = client.r2.buckets.delete( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(object, bucket, path=["response"]) @@ -209,7 +209,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: bucket = client.r2.buckets.get( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(Bucket, bucket, path=["response"]) @@ -277,7 +277,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare name="example-bucket", location_hint="apac", storage_class="Standard", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(Bucket, bucket, path=["response"]) @@ -337,7 +337,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) order="name", per_page=1, start_after="my-bucket", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(BucketListResponse, bucket, path=["response"]) @@ -390,7 +390,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare bucket = await async_client.r2.buckets.delete( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(object, bucket, path=["response"]) @@ -452,7 +452,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - bucket = await async_client.r2.buckets.get( bucket_name="example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", - cf_r2_jurisdiction="default", + jurisdiction="default", ) assert_matches_type(Bucket, bucket, path=["response"]) diff --git a/tests/api_resources/radar/ai/bots/test_summary.py b/tests/api_resources/radar/ai/bots/test_summary.py index a9d3715f712..ca5d4e987c0 100644 --- a/tests/api_resources/radar/ai/bots/test_summary.py +++ b/tests/api_resources/radar/ai/bots/test_summary.py @@ -32,6 +32,7 @@ def test_method_user_agent_with_all_params(self, client: Cloudflare) -> None: date_range=["7d"], date_start=[parse_datetime("2019-12-27T18:11:19.117Z")], format="JSON", + limit_per_group=10, location=["string"], name=["string"], ) @@ -75,6 +76,7 @@ async def test_method_user_agent_with_all_params(self, async_client: AsyncCloudf date_range=["7d"], date_start=[parse_datetime("2019-12-27T18:11:19.117Z")], format="JSON", + limit_per_group=10, location=["string"], name=["string"], ) diff --git a/tests/api_resources/radar/ai/test_timeseries_groups.py b/tests/api_resources/radar/ai/test_timeseries_groups.py index 51184d25d05..94ccc123297 100644 --- a/tests/api_resources/radar/ai/test_timeseries_groups.py +++ b/tests/api_resources/radar/ai/test_timeseries_groups.py @@ -33,7 +33,7 @@ def test_method_user_agent_with_all_params(self, client: Cloudflare) -> None: date_range=["7d"], date_start=[parse_datetime("2019-12-27T18:11:19.117Z")], format="JSON", - limit_per_group=4, + limit_per_group=10, location=["string"], name=["string"], ) @@ -78,7 +78,7 @@ async def test_method_user_agent_with_all_params(self, async_client: AsyncCloudf date_range=["7d"], date_start=[parse_datetime("2019-12-27T18:11:19.117Z")], format="JSON", - limit_per_group=4, + limit_per_group=10, location=["string"], name=["string"], ) diff --git a/tests/api_resources/radar/as112/test_summary.py b/tests/api_resources/radar/as112/test_summary.py index caffb58e7bb..d5956baed72 100644 --- a/tests/api_resources/radar/as112/test_summary.py +++ b/tests/api_resources/radar/as112/test_summary.py @@ -195,6 +195,7 @@ def test_method_query_type_with_all_params(self, client: Cloudflare) -> None: date_range=["7d"], date_start=[parse_datetime("2019-12-27T18:11:19.117Z")], format="JSON", + limit_per_group=10, location=["string"], name=["string"], ) @@ -234,6 +235,7 @@ def test_method_response_codes_with_all_params(self, client: Cloudflare) -> None date_range=["7d"], date_start=[parse_datetime("2019-12-27T18:11:19.117Z")], format="JSON", + limit_per_group=10, location=["string"], name=["string"], ) @@ -433,6 +435,7 @@ async def test_method_query_type_with_all_params(self, async_client: AsyncCloudf date_range=["7d"], date_start=[parse_datetime("2019-12-27T18:11:19.117Z")], format="JSON", + limit_per_group=10, location=["string"], name=["string"], ) @@ -472,6 +475,7 @@ async def test_method_response_codes_with_all_params(self, async_client: AsyncCl date_range=["7d"], date_start=[parse_datetime("2019-12-27T18:11:19.117Z")], format="JSON", + limit_per_group=10, location=["string"], name=["string"], ) diff --git a/tests/api_resources/radar/as112/test_timeseries_groups.py b/tests/api_resources/radar/as112/test_timeseries_groups.py index 703a7fd254f..26adfcf7eab 100644 --- a/tests/api_resources/radar/as112/test_timeseries_groups.py +++ b/tests/api_resources/radar/as112/test_timeseries_groups.py @@ -200,6 +200,7 @@ def test_method_query_type_with_all_params(self, client: Cloudflare) -> None: date_range=["7d"], date_start=[parse_datetime("2019-12-27T18:11:19.117Z")], format="JSON", + limit_per_group=10, location=["string"], name=["string"], ) @@ -240,6 +241,7 @@ def test_method_response_codes_with_all_params(self, client: Cloudflare) -> None date_range=["7d"], date_start=[parse_datetime("2019-12-27T18:11:19.117Z")], format="JSON", + limit_per_group=10, location=["string"], name=["string"], ) @@ -444,6 +446,7 @@ async def test_method_query_type_with_all_params(self, async_client: AsyncCloudf date_range=["7d"], date_start=[parse_datetime("2019-12-27T18:11:19.117Z")], format="JSON", + limit_per_group=10, location=["string"], name=["string"], ) @@ -484,6 +487,7 @@ async def test_method_response_codes_with_all_params(self, async_client: AsyncCl date_range=["7d"], date_start=[parse_datetime("2019-12-27T18:11:19.117Z")], format="JSON", + limit_per_group=10, location=["string"], name=["string"], ) diff --git a/tests/api_resources/radar/attacks/layer3/test_summary.py b/tests/api_resources/radar/attacks/layer3/test_summary.py index dd0ffe08b6c..6e0d57be6a1 100644 --- a/tests/api_resources/radar/attacks/layer3/test_summary.py +++ b/tests/api_resources/radar/attacks/layer3/test_summary.py @@ -241,6 +241,7 @@ def test_method_vector_with_all_params(self, client: Cloudflare) -> None: direction="ORIGIN", format="JSON", ip_version=["IPv4"], + limit_per_group=10, location=["string"], name=["string"], protocol=["UDP"], @@ -487,6 +488,7 @@ async def test_method_vector_with_all_params(self, async_client: AsyncCloudflare direction="ORIGIN", format="JSON", ip_version=["IPv4"], + limit_per_group=10, location=["string"], name=["string"], protocol=["UDP"], diff --git a/tests/api_resources/radar/attacks/layer3/test_timeseries_groups.py b/tests/api_resources/radar/attacks/layer3/test_timeseries_groups.py index 0fd0a3e6c90..258338056b5 100644 --- a/tests/api_resources/radar/attacks/layer3/test_timeseries_groups.py +++ b/tests/api_resources/radar/attacks/layer3/test_timeseries_groups.py @@ -169,7 +169,7 @@ def test_method_industry_with_all_params(self, client: Cloudflare) -> None: direction="ORIGIN", format="JSON", ip_version=["IPv4"], - limit_per_group=4, + limit_per_group=10, location=["string"], name=["string"], normalization="PERCENTAGE", @@ -297,7 +297,7 @@ def test_method_vector_with_all_params(self, client: Cloudflare) -> None: direction="ORIGIN", format="JSON", ip_version=["IPv4"], - limit_per_group=4, + limit_per_group=10, location=["string"], name=["string"], normalization="PERCENTAGE", @@ -341,7 +341,7 @@ def test_method_vertical_with_all_params(self, client: Cloudflare) -> None: direction="ORIGIN", format="JSON", ip_version=["IPv4"], - limit_per_group=4, + limit_per_group=10, location=["string"], name=["string"], normalization="PERCENTAGE", @@ -515,7 +515,7 @@ async def test_method_industry_with_all_params(self, async_client: AsyncCloudfla direction="ORIGIN", format="JSON", ip_version=["IPv4"], - limit_per_group=4, + limit_per_group=10, location=["string"], name=["string"], normalization="PERCENTAGE", @@ -643,7 +643,7 @@ async def test_method_vector_with_all_params(self, async_client: AsyncCloudflare direction="ORIGIN", format="JSON", ip_version=["IPv4"], - limit_per_group=4, + limit_per_group=10, location=["string"], name=["string"], normalization="PERCENTAGE", @@ -687,7 +687,7 @@ async def test_method_vertical_with_all_params(self, async_client: AsyncCloudfla direction="ORIGIN", format="JSON", ip_version=["IPv4"], - limit_per_group=4, + limit_per_group=10, location=["string"], name=["string"], normalization="PERCENTAGE", diff --git a/tests/api_resources/radar/attacks/layer7/test_summary.py b/tests/api_resources/radar/attacks/layer7/test_summary.py index 64b5d969caf..694c8f4497c 100644 --- a/tests/api_resources/radar/attacks/layer7/test_summary.py +++ b/tests/api_resources/radar/attacks/layer7/test_summary.py @@ -80,6 +80,7 @@ def test_method_http_method_with_all_params(self, client: Cloudflare) -> None: format="JSON", http_version=["HTTPv1"], ip_version=["IPv4"], + limit_per_group=10, location=["string"], mitigation_product=["DDOS"], name=["string"], @@ -207,6 +208,7 @@ def test_method_managed_rules_with_all_params(self, client: Cloudflare) -> None: http_method=["GET"], http_version=["HTTPv1"], ip_version=["IPv4"], + limit_per_group=10, location=["string"], mitigation_product=["DDOS"], name=["string"], @@ -250,6 +252,7 @@ def test_method_mitigation_product_with_all_params(self, client: Cloudflare) -> http_method=["GET"], http_version=["HTTPv1"], ip_version=["IPv4"], + limit_per_group=10, location=["string"], name=["string"], ) @@ -334,6 +337,7 @@ async def test_method_http_method_with_all_params(self, async_client: AsyncCloud format="JSON", http_version=["HTTPv1"], ip_version=["IPv4"], + limit_per_group=10, location=["string"], mitigation_product=["DDOS"], name=["string"], @@ -461,6 +465,7 @@ async def test_method_managed_rules_with_all_params(self, async_client: AsyncClo http_method=["GET"], http_version=["HTTPv1"], ip_version=["IPv4"], + limit_per_group=10, location=["string"], mitigation_product=["DDOS"], name=["string"], @@ -504,6 +509,7 @@ async def test_method_mitigation_product_with_all_params(self, async_client: Asy http_method=["GET"], http_version=["HTTPv1"], ip_version=["IPv4"], + limit_per_group=10, location=["string"], name=["string"], ) diff --git a/tests/api_resources/radar/attacks/layer7/test_timeseries_groups.py b/tests/api_resources/radar/attacks/layer7/test_timeseries_groups.py index 54a36ba067e..853d11fb63c 100644 --- a/tests/api_resources/radar/attacks/layer7/test_timeseries_groups.py +++ b/tests/api_resources/radar/attacks/layer7/test_timeseries_groups.py @@ -84,6 +84,7 @@ def test_method_http_method_with_all_params(self, client: Cloudflare) -> None: format="JSON", http_version=["HTTPv1"], ip_version=["IPv4"], + limit_per_group=10, location=["string"], mitigation_product=["DDOS"], name=["string"], @@ -173,7 +174,7 @@ def test_method_industry_with_all_params(self, client: Cloudflare) -> None: http_method=["GET"], http_version=["HTTPv1"], ip_version=["IPv4"], - limit_per_group=4, + limit_per_group=10, location=["string"], mitigation_product=["DDOS"], name=["string"], @@ -263,6 +264,7 @@ def test_method_managed_rules_with_all_params(self, client: Cloudflare) -> None: http_method=["GET"], http_version=["HTTPv1"], ip_version=["IPv4"], + limit_per_group=10, location=["string"], mitigation_product=["DDOS"], name=["string"], @@ -308,6 +310,7 @@ def test_method_mitigation_product_with_all_params(self, client: Cloudflare) -> http_method=["GET"], http_version=["HTTPv1"], ip_version=["IPv4"], + limit_per_group=10, location=["string"], name=["string"], normalization="PERCENTAGE", @@ -352,7 +355,7 @@ def test_method_vertical_with_all_params(self, client: Cloudflare) -> None: http_method=["GET"], http_version=["HTTPv1"], ip_version=["IPv4"], - limit_per_group=4, + limit_per_group=10, location=["string"], mitigation_product=["DDOS"], name=["string"], @@ -441,6 +444,7 @@ async def test_method_http_method_with_all_params(self, async_client: AsyncCloud format="JSON", http_version=["HTTPv1"], ip_version=["IPv4"], + limit_per_group=10, location=["string"], mitigation_product=["DDOS"], name=["string"], @@ -530,7 +534,7 @@ async def test_method_industry_with_all_params(self, async_client: AsyncCloudfla http_method=["GET"], http_version=["HTTPv1"], ip_version=["IPv4"], - limit_per_group=4, + limit_per_group=10, location=["string"], mitigation_product=["DDOS"], name=["string"], @@ -620,6 +624,7 @@ async def test_method_managed_rules_with_all_params(self, async_client: AsyncClo http_method=["GET"], http_version=["HTTPv1"], ip_version=["IPv4"], + limit_per_group=10, location=["string"], mitigation_product=["DDOS"], name=["string"], @@ -665,6 +670,7 @@ async def test_method_mitigation_product_with_all_params(self, async_client: Asy http_method=["GET"], http_version=["HTTPv1"], ip_version=["IPv4"], + limit_per_group=10, location=["string"], name=["string"], normalization="PERCENTAGE", @@ -709,7 +715,7 @@ async def test_method_vertical_with_all_params(self, async_client: AsyncCloudfla http_method=["GET"], http_version=["HTTPv1"], ip_version=["IPv4"], - limit_per_group=4, + limit_per_group=10, location=["string"], mitigation_product=["DDOS"], name=["string"], diff --git a/tests/api_resources/radar/http/test_timeseries_groups.py b/tests/api_resources/radar/http/test_timeseries_groups.py index 8c0d3decdd5..8789e6c61ed 100644 --- a/tests/api_resources/radar/http/test_timeseries_groups.py +++ b/tests/api_resources/radar/http/test_timeseries_groups.py @@ -95,7 +95,7 @@ def test_method_browser_with_all_params(self, client: Cloudflare) -> None: http_protocol=["HTTP"], http_version=["HTTPv1"], ip_version=["IPv4"], - limit_per_group=4, + limit_per_group=10, location=["string"], name=["string"], os=["WINDOWS"], @@ -143,6 +143,7 @@ def test_method_browser_family_with_all_params(self, client: Cloudflare) -> None http_protocol=["HTTP"], http_version=["HTTPv1"], ip_version=["IPv4"], + limit_per_group=10, location=["string"], name=["string"], os=["WINDOWS"], @@ -563,7 +564,7 @@ async def test_method_browser_with_all_params(self, async_client: AsyncCloudflar http_protocol=["HTTP"], http_version=["HTTPv1"], ip_version=["IPv4"], - limit_per_group=4, + limit_per_group=10, location=["string"], name=["string"], os=["WINDOWS"], @@ -611,6 +612,7 @@ async def test_method_browser_family_with_all_params(self, async_client: AsyncCl http_protocol=["HTTP"], http_version=["HTTPv1"], ip_version=["IPv4"], + limit_per_group=10, location=["string"], name=["string"], os=["WINDOWS"], diff --git a/tests/api_resources/radar/ranking/test_domain.py b/tests/api_resources/radar/ranking/test_domain.py index b67fc2b8ad7..26021593dd9 100644 --- a/tests/api_resources/radar/ranking/test_domain.py +++ b/tests/api_resources/radar/ranking/test_domain.py @@ -9,6 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare._utils import parse_date from cloudflare.types.radar.ranking import DomainGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,8 +29,9 @@ def test_method_get(self, client: Cloudflare) -> None: def test_method_get_with_all_params(self, client: Cloudflare) -> None: domain = client.radar.ranking.domain.get( domain="google.com", - date=["string"], + date=[parse_date("2019-12-27")], format="JSON", + include_top_locations=True, limit=5, name=["string"], ranking_type="POPULAR", @@ -82,8 +84,9 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: domain = await async_client.radar.ranking.domain.get( domain="google.com", - date=["string"], + date=[parse_date("2019-12-27")], format="JSON", + include_top_locations=True, limit=5, name=["string"], ranking_type="POPULAR", diff --git a/tests/api_resources/radar/test_ranking.py b/tests/api_resources/radar/test_ranking.py index 9e4b188e021..6608571dbd3 100644 --- a/tests/api_resources/radar/test_ranking.py +++ b/tests/api_resources/radar/test_ranking.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare._utils import parse_datetime +from cloudflare._utils import parse_date, parse_datetime from cloudflare.types.radar import ( RankingTopResponse, RankingTimeseriesGroupsResponse, @@ -69,7 +69,7 @@ def test_method_top(self, client: Cloudflare) -> None: @parametrize def test_method_top_with_all_params(self, client: Cloudflare) -> None: ranking = client.radar.ranking.top( - date=["string"], + date=[parse_date("2019-12-27")], format="JSON", limit=5, location=["string"], @@ -150,7 +150,7 @@ async def test_method_top(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_top_with_all_params(self, async_client: AsyncCloudflare) -> None: ranking = await async_client.radar.ranking.top( - date=["string"], + date=[parse_date("2019-12-27")], format="JSON", limit=5, location=["string"], diff --git a/tests/api_resources/rulesets/test_rules.py b/tests/api_resources/rulesets/test_rules.py index 117eee8c295..d57aa588aa2 100644 --- a/tests/api_resources/rulesets/test_rules.py +++ b/tests/api_resources/rulesets/test_rules.py @@ -1411,16 +1411,7 @@ def test_method_create_with_all_params_overload_15(self, client: Cloudflare) -> "include": ["string"], }, "host": {"resolved": True}, - "query_string": { - "exclude": { - "all": True, - "list": ["string"], - }, - "include": { - "all": True, - "list": ["string"], - }, - }, + "query_string": {"include": {"list": ["foo", "bar"]}}, "user": { "device_type": True, "geo": True, @@ -3468,16 +3459,7 @@ def test_method_edit_with_all_params_overload_15(self, client: Cloudflare) -> No "include": ["string"], }, "host": {"resolved": True}, - "query_string": { - "exclude": { - "all": True, - "list": ["string"], - }, - "include": { - "all": True, - "list": ["string"], - }, - }, + "query_string": {"include": {"list": ["foo", "bar"]}}, "user": { "device_type": True, "geo": True, @@ -5304,16 +5286,7 @@ async def test_method_create_with_all_params_overload_15(self, async_client: Asy "include": ["string"], }, "host": {"resolved": True}, - "query_string": { - "exclude": { - "all": True, - "list": ["string"], - }, - "include": { - "all": True, - "list": ["string"], - }, - }, + "query_string": {"include": {"list": ["foo", "bar"]}}, "user": { "device_type": True, "geo": True, @@ -7361,16 +7334,7 @@ async def test_method_edit_with_all_params_overload_15(self, async_client: Async "include": ["string"], }, "host": {"resolved": True}, - "query_string": { - "exclude": { - "all": True, - "list": ["string"], - }, - "include": { - "all": True, - "list": ["string"], - }, - }, + "query_string": {"include": {"list": ["foo", "bar"]}}, "user": { "device_type": True, "geo": True, diff --git a/tests/api_resources/spectrum/test_apps.py b/tests/api_resources/spectrum/test_apps.py index a5109d18f6a..406363c48d8 100644 --- a/tests/api_resources/spectrum/test_apps.py +++ b/tests/api_resources/spectrum/test_apps.py @@ -383,6 +383,7 @@ def test_path_params_update_overload_2(self, client: Cloudflare) -> None: protocol="tcp/22", ) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_method_list(self, client: Cloudflare) -> None: app = client.spectrum.apps.list( @@ -390,6 +391,7 @@ def test_method_list(self, client: Cloudflare) -> None: ) assert_matches_type(SyncV4PagePaginationArray[Optional[AppListResponse]], app, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: app = client.spectrum.apps.list( @@ -401,6 +403,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: ) assert_matches_type(SyncV4PagePaginationArray[Optional[AppListResponse]], app, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.spectrum.apps.with_raw_response.list( @@ -412,6 +415,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: app = response.parse() assert_matches_type(SyncV4PagePaginationArray[Optional[AppListResponse]], app, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: with client.spectrum.apps.with_streaming_response.list( @@ -425,6 +429,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize def test_path_params_list(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): @@ -891,6 +896,7 @@ async def test_path_params_update_overload_2(self, async_client: AsyncCloudflare protocol="tcp/22", ) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: app = await async_client.spectrum.apps.list( @@ -898,6 +904,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: ) assert_matches_type(AsyncV4PagePaginationArray[Optional[AppListResponse]], app, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: app = await async_client.spectrum.apps.list( @@ -909,6 +916,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) ) assert_matches_type(AsyncV4PagePaginationArray[Optional[AppListResponse]], app, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.spectrum.apps.with_raw_response.list( @@ -920,6 +928,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: app = await response.parse() assert_matches_type(AsyncV4PagePaginationArray[Optional[AppListResponse]], app, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: async with async_client.spectrum.apps.with_streaming_response.list( @@ -933,6 +942,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate HTTP 422 errors on test suite") @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): diff --git a/tests/api_resources/test_abuse_reports.py b/tests/api_resources/test_abuse_reports.py new file mode 100644 index 00000000000..ff8d92dee38 --- /dev/null +++ b/tests/api_resources/test_abuse_reports.py @@ -0,0 +1,243 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAbuseReports: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + abuse_report = client.abuse_reports.create( + report_type="abuse_dmca", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + act="abuse_dmca", + email="email", + email2="email2", + host_notification="send", + ncmec_notification="send", + owner_notification="send", + urls="urls", + ) + assert_matches_type(str, abuse_report, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + abuse_report = client.abuse_reports.create( + report_type="abuse_dmca", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + act="abuse_dmca", + email="email", + email2="email2", + host_notification="send", + ncmec_notification="send", + owner_notification="send", + urls="urls", + address1="x", + agent_name="x", + agree=0, + city="x", + comments="x", + company="x", + country="x", + destination_ips="destination_ips", + justification="x", + name="x", + ncsei_subject_representation=True, + original_work="x", + ports_protocols="ports_protocols", + signature="signature", + source_ips="source_ips", + state="x", + tele="x", + title="x", + trademark_number="x", + trademark_office="x", + trademark_symbol="x", + ) + assert_matches_type(str, abuse_report, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.abuse_reports.with_raw_response.create( + report_type="abuse_dmca", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + act="abuse_dmca", + email="email", + email2="email2", + host_notification="send", + ncmec_notification="send", + owner_notification="send", + urls="urls", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + abuse_report = response.parse() + assert_matches_type(str, abuse_report, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.abuse_reports.with_streaming_response.create( + report_type="abuse_dmca", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + act="abuse_dmca", + email="email", + email2="email2", + host_notification="send", + ncmec_notification="send", + owner_notification="send", + urls="urls", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + abuse_report = response.parse() + assert_matches_type(str, abuse_report, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @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.abuse_reports.with_raw_response.create( + report_type="abuse_dmca", + account_id="", + act="abuse_dmca", + email="email", + email2="email2", + host_notification="send", + ncmec_notification="send", + owner_notification="send", + urls="urls", + ) + + +class TestAsyncAbuseReports: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + abuse_report = await async_client.abuse_reports.create( + report_type="abuse_dmca", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + act="abuse_dmca", + email="email", + email2="email2", + host_notification="send", + ncmec_notification="send", + owner_notification="send", + urls="urls", + ) + assert_matches_type(str, abuse_report, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + abuse_report = await async_client.abuse_reports.create( + report_type="abuse_dmca", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + act="abuse_dmca", + email="email", + email2="email2", + host_notification="send", + ncmec_notification="send", + owner_notification="send", + urls="urls", + address1="x", + agent_name="x", + agree=0, + city="x", + comments="x", + company="x", + country="x", + destination_ips="destination_ips", + justification="x", + name="x", + ncsei_subject_representation=True, + original_work="x", + ports_protocols="ports_protocols", + signature="signature", + source_ips="source_ips", + state="x", + tele="x", + title="x", + trademark_number="x", + trademark_office="x", + trademark_symbol="x", + ) + assert_matches_type(str, abuse_report, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.abuse_reports.with_raw_response.create( + report_type="abuse_dmca", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + act="abuse_dmca", + email="email", + email2="email2", + host_notification="send", + ncmec_notification="send", + owner_notification="send", + urls="urls", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + abuse_report = await response.parse() + assert_matches_type(str, abuse_report, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.abuse_reports.with_streaming_response.create( + report_type="abuse_dmca", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + act="abuse_dmca", + email="email", + email2="email2", + host_notification="send", + ncmec_notification="send", + owner_notification="send", + urls="urls", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + abuse_report = await response.parse() + assert_matches_type(str, abuse_report, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @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.abuse_reports.with_raw_response.create( + report_type="abuse_dmca", + account_id="", + act="abuse_dmca", + email="email", + email2="email2", + host_notification="send", + ncmec_notification="send", + owner_notification="send", + urls="urls", + ) diff --git a/tests/api_resources/workers/test_ai.py b/tests/api_resources/test_ai.py similarity index 87% rename from tests/api_resources/workers/test_ai.py rename to tests/api_resources/test_ai.py index 4f9e0996455..ab8fa8cc49c 100644 --- a/tests/api_resources/workers/test_ai.py +++ b/tests/api_resources/test_ai.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.workers import AIRunResponse +from cloudflare.types.ai import AIRunResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -19,7 +19,7 @@ class TestAI: @parametrize def test_method_run_overload_1(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", text="x", @@ -28,7 +28,7 @@ def test_method_run_overload_1(self, client: Cloudflare) -> None: @parametrize def test_raw_response_run_overload_1(self, client: Cloudflare) -> None: - response = client.workers.ai.with_raw_response.run( + response = client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", text="x", @@ -41,7 +41,7 @@ def test_raw_response_run_overload_1(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_run_overload_1(self, client: Cloudflare) -> None: - with client.workers.ai.with_streaming_response.run( + with client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", text="x", @@ -57,14 +57,14 @@ def test_streaming_response_run_overload_1(self, client: Cloudflare) -> None: @parametrize def test_path_params_run_overload_1(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="model_name", account_id="", text="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", text="x", @@ -72,7 +72,7 @@ def test_path_params_run_overload_1(self, client: Cloudflare) -> None: @parametrize def test_method_run_overload_2(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -81,7 +81,7 @@ def test_method_run_overload_2(self, client: Cloudflare) -> None: @parametrize def test_method_run_with_all_params_overload_2(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -100,7 +100,7 @@ def test_method_run_with_all_params_overload_2(self, client: Cloudflare) -> None @parametrize def test_raw_response_run_overload_2(self, client: Cloudflare) -> None: - response = client.workers.ai.with_raw_response.run( + response = client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -113,7 +113,7 @@ def test_raw_response_run_overload_2(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_run_overload_2(self, client: Cloudflare) -> None: - with client.workers.ai.with_streaming_response.run( + with client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -129,14 +129,14 @@ def test_streaming_response_run_overload_2(self, client: Cloudflare) -> None: @parametrize def test_path_params_run_overload_2(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="model_name", account_id="", prompt="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -144,7 +144,7 @@ def test_path_params_run_overload_2(self, client: Cloudflare) -> None: @parametrize def test_method_run_overload_3(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -153,7 +153,7 @@ def test_method_run_overload_3(self, client: Cloudflare) -> None: @parametrize def test_method_run_with_all_params_overload_3(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -163,7 +163,7 @@ def test_method_run_with_all_params_overload_3(self, client: Cloudflare) -> None @parametrize def test_raw_response_run_overload_3(self, client: Cloudflare) -> None: - response = client.workers.ai.with_raw_response.run( + response = client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -176,7 +176,7 @@ def test_raw_response_run_overload_3(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_run_overload_3(self, client: Cloudflare) -> None: - with client.workers.ai.with_streaming_response.run( + with client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -192,14 +192,14 @@ def test_streaming_response_run_overload_3(self, client: Cloudflare) -> None: @parametrize def test_path_params_run_overload_3(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="model_name", account_id="", prompt="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -207,7 +207,7 @@ def test_path_params_run_overload_3(self, client: Cloudflare) -> None: @parametrize def test_method_run_overload_4(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", text="x", @@ -216,7 +216,7 @@ def test_method_run_overload_4(self, client: Cloudflare) -> None: @parametrize def test_raw_response_run_overload_4(self, client: Cloudflare) -> None: - response = client.workers.ai.with_raw_response.run( + response = client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", text="x", @@ -229,7 +229,7 @@ def test_raw_response_run_overload_4(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_run_overload_4(self, client: Cloudflare) -> None: - with client.workers.ai.with_streaming_response.run( + with client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", text="x", @@ -245,14 +245,14 @@ def test_streaming_response_run_overload_4(self, client: Cloudflare) -> None: @parametrize def test_path_params_run_overload_4(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="model_name", account_id="", text="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", text="x", @@ -260,7 +260,7 @@ def test_path_params_run_overload_4(self, client: Cloudflare) -> None: @parametrize def test_method_run_overload_5(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", audio=[0], @@ -269,7 +269,7 @@ def test_method_run_overload_5(self, client: Cloudflare) -> None: @parametrize def test_method_run_with_all_params_overload_5(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", audio=[0], @@ -280,7 +280,7 @@ def test_method_run_with_all_params_overload_5(self, client: Cloudflare) -> None @parametrize def test_raw_response_run_overload_5(self, client: Cloudflare) -> None: - response = client.workers.ai.with_raw_response.run( + response = client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", audio=[0], @@ -293,7 +293,7 @@ def test_raw_response_run_overload_5(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_run_overload_5(self, client: Cloudflare) -> None: - with client.workers.ai.with_streaming_response.run( + with client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", audio=[0], @@ -309,14 +309,14 @@ def test_streaming_response_run_overload_5(self, client: Cloudflare) -> None: @parametrize def test_path_params_run_overload_5(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="model_name", account_id="", audio=[0], ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", audio=[0], @@ -324,7 +324,7 @@ def test_path_params_run_overload_5(self, client: Cloudflare) -> None: @parametrize def test_method_run_overload_6(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], @@ -333,7 +333,7 @@ def test_method_run_overload_6(self, client: Cloudflare) -> None: @parametrize def test_raw_response_run_overload_6(self, client: Cloudflare) -> None: - response = client.workers.ai.with_raw_response.run( + response = client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], @@ -346,7 +346,7 @@ def test_raw_response_run_overload_6(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_run_overload_6(self, client: Cloudflare) -> None: - with client.workers.ai.with_streaming_response.run( + with client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], @@ -362,14 +362,14 @@ def test_streaming_response_run_overload_6(self, client: Cloudflare) -> None: @parametrize def test_path_params_run_overload_6(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="model_name", account_id="", image=[0], ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], @@ -377,7 +377,7 @@ def test_path_params_run_overload_6(self, client: Cloudflare) -> None: @parametrize def test_method_run_overload_7(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -385,7 +385,7 @@ def test_method_run_overload_7(self, client: Cloudflare) -> None: @parametrize def test_method_run_with_all_params_overload_7(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], @@ -394,7 +394,7 @@ def test_method_run_with_all_params_overload_7(self, client: Cloudflare) -> None @parametrize def test_raw_response_run_overload_7(self, client: Cloudflare) -> None: - response = client.workers.ai.with_raw_response.run( + response = client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -406,7 +406,7 @@ def test_raw_response_run_overload_7(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_run_overload_7(self, client: Cloudflare) -> None: - with client.workers.ai.with_streaming_response.run( + with client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: @@ -421,20 +421,20 @@ def test_streaming_response_run_overload_7(self, client: Cloudflare) -> None: @parametrize def test_path_params_run_overload_7(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="model_name", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @parametrize def test_method_run_overload_8(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -443,7 +443,7 @@ def test_method_run_overload_8(self, client: Cloudflare) -> None: @parametrize def test_method_run_with_all_params_overload_8(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -463,7 +463,7 @@ def test_method_run_with_all_params_overload_8(self, client: Cloudflare) -> None @parametrize def test_raw_response_run_overload_8(self, client: Cloudflare) -> None: - response = client.workers.ai.with_raw_response.run( + response = client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -476,7 +476,7 @@ def test_raw_response_run_overload_8(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_run_overload_8(self, client: Cloudflare) -> None: - with client.workers.ai.with_streaming_response.run( + with client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -492,14 +492,14 @@ def test_streaming_response_run_overload_8(self, client: Cloudflare) -> None: @parametrize def test_path_params_run_overload_8(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="model_name", account_id="", prompt="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -507,7 +507,7 @@ def test_path_params_run_overload_8(self, client: Cloudflare) -> None: @parametrize def test_method_run_overload_9(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", messages=[ @@ -521,7 +521,7 @@ def test_method_run_overload_9(self, client: Cloudflare) -> None: @parametrize def test_method_run_with_all_params_overload_9(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", messages=[ @@ -566,7 +566,7 @@ def test_method_run_with_all_params_overload_9(self, client: Cloudflare) -> None @parametrize def test_raw_response_run_overload_9(self, client: Cloudflare) -> None: - response = client.workers.ai.with_raw_response.run( + response = client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", messages=[ @@ -584,7 +584,7 @@ def test_raw_response_run_overload_9(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_run_overload_9(self, client: Cloudflare) -> None: - with client.workers.ai.with_streaming_response.run( + with client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", messages=[ @@ -605,7 +605,7 @@ def test_streaming_response_run_overload_9(self, client: Cloudflare) -> None: @parametrize def test_path_params_run_overload_9(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="model_name", account_id="", messages=[ @@ -617,7 +617,7 @@ def test_path_params_run_overload_9(self, client: Cloudflare) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", messages=[ @@ -630,7 +630,7 @@ def test_path_params_run_overload_9(self, client: Cloudflare) -> None: @parametrize def test_method_run_overload_10(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", target_lang="target_lang", @@ -640,7 +640,7 @@ def test_method_run_overload_10(self, client: Cloudflare) -> None: @parametrize def test_method_run_with_all_params_overload_10(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", target_lang="target_lang", @@ -651,7 +651,7 @@ def test_method_run_with_all_params_overload_10(self, client: Cloudflare) -> Non @parametrize def test_raw_response_run_overload_10(self, client: Cloudflare) -> None: - response = client.workers.ai.with_raw_response.run( + response = client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", target_lang="target_lang", @@ -665,7 +665,7 @@ def test_raw_response_run_overload_10(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_run_overload_10(self, client: Cloudflare) -> None: - with client.workers.ai.with_streaming_response.run( + with client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", target_lang="target_lang", @@ -682,7 +682,7 @@ def test_streaming_response_run_overload_10(self, client: Cloudflare) -> None: @parametrize def test_path_params_run_overload_10(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="model_name", account_id="", target_lang="target_lang", @@ -690,7 +690,7 @@ def test_path_params_run_overload_10(self, client: Cloudflare) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", target_lang="target_lang", @@ -699,7 +699,7 @@ def test_path_params_run_overload_10(self, client: Cloudflare) -> None: @parametrize def test_method_run_overload_11(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", input_text="x", @@ -708,7 +708,7 @@ def test_method_run_overload_11(self, client: Cloudflare) -> None: @parametrize def test_method_run_with_all_params_overload_11(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", input_text="x", @@ -718,7 +718,7 @@ def test_method_run_with_all_params_overload_11(self, client: Cloudflare) -> Non @parametrize def test_raw_response_run_overload_11(self, client: Cloudflare) -> None: - response = client.workers.ai.with_raw_response.run( + response = client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", input_text="x", @@ -731,7 +731,7 @@ def test_raw_response_run_overload_11(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_run_overload_11(self, client: Cloudflare) -> None: - with client.workers.ai.with_streaming_response.run( + with client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", input_text="x", @@ -747,14 +747,14 @@ def test_streaming_response_run_overload_11(self, client: Cloudflare) -> None: @parametrize def test_path_params_run_overload_11(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="model_name", account_id="", input_text="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", input_text="x", @@ -762,7 +762,7 @@ def test_path_params_run_overload_11(self, client: Cloudflare) -> None: @parametrize def test_method_run_overload_12(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], @@ -771,7 +771,7 @@ def test_method_run_overload_12(self, client: Cloudflare) -> None: @parametrize def test_method_run_with_all_params_overload_12(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( + ai = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], @@ -784,7 +784,7 @@ def test_method_run_with_all_params_overload_12(self, client: Cloudflare) -> Non @parametrize def test_raw_response_run_overload_12(self, client: Cloudflare) -> None: - response = client.workers.ai.with_raw_response.run( + response = client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], @@ -797,7 +797,7 @@ def test_raw_response_run_overload_12(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_run_overload_12(self, client: Cloudflare) -> None: - with client.workers.ai.with_streaming_response.run( + with client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], @@ -813,14 +813,14 @@ def test_streaming_response_run_overload_12(self, client: Cloudflare) -> None: @parametrize def test_path_params_run_overload_12(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="model_name", account_id="", image=[0], ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - client.workers.ai.with_raw_response.run( + client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], @@ -832,7 +832,7 @@ class TestAsyncAI: @parametrize async def test_method_run_overload_1(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", text="x", @@ -841,7 +841,7 @@ async def test_method_run_overload_1(self, async_client: AsyncCloudflare) -> Non @parametrize async def test_raw_response_run_overload_1(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.ai.with_raw_response.run( + response = await async_client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", text="x", @@ -854,7 +854,7 @@ async def test_raw_response_run_overload_1(self, async_client: AsyncCloudflare) @parametrize async def test_streaming_response_run_overload_1(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.ai.with_streaming_response.run( + async with async_client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", text="x", @@ -870,14 +870,14 @@ async def test_streaming_response_run_overload_1(self, async_client: AsyncCloudf @parametrize async def test_path_params_run_overload_1(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.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="model_name", account_id="", text="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - await async_client.workers.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", text="x", @@ -885,7 +885,7 @@ async def test_path_params_run_overload_1(self, async_client: AsyncCloudflare) - @parametrize async def test_method_run_overload_2(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -894,7 +894,7 @@ async def test_method_run_overload_2(self, async_client: AsyncCloudflare) -> Non @parametrize async def test_method_run_with_all_params_overload_2(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -913,7 +913,7 @@ async def test_method_run_with_all_params_overload_2(self, async_client: AsyncCl @parametrize async def test_raw_response_run_overload_2(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.ai.with_raw_response.run( + response = await async_client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -926,7 +926,7 @@ async def test_raw_response_run_overload_2(self, async_client: AsyncCloudflare) @parametrize async def test_streaming_response_run_overload_2(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.ai.with_streaming_response.run( + async with async_client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -942,14 +942,14 @@ async def test_streaming_response_run_overload_2(self, async_client: AsyncCloudf @parametrize async def test_path_params_run_overload_2(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.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="model_name", account_id="", prompt="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - await async_client.workers.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -957,7 +957,7 @@ async def test_path_params_run_overload_2(self, async_client: AsyncCloudflare) - @parametrize async def test_method_run_overload_3(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -966,7 +966,7 @@ async def test_method_run_overload_3(self, async_client: AsyncCloudflare) -> Non @parametrize async def test_method_run_with_all_params_overload_3(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -976,7 +976,7 @@ async def test_method_run_with_all_params_overload_3(self, async_client: AsyncCl @parametrize async def test_raw_response_run_overload_3(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.ai.with_raw_response.run( + response = await async_client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -989,7 +989,7 @@ async def test_raw_response_run_overload_3(self, async_client: AsyncCloudflare) @parametrize async def test_streaming_response_run_overload_3(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.ai.with_streaming_response.run( + async with async_client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -1005,14 +1005,14 @@ async def test_streaming_response_run_overload_3(self, async_client: AsyncCloudf @parametrize async def test_path_params_run_overload_3(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.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="model_name", account_id="", prompt="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - await async_client.workers.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -1020,7 +1020,7 @@ async def test_path_params_run_overload_3(self, async_client: AsyncCloudflare) - @parametrize async def test_method_run_overload_4(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", text="x", @@ -1029,7 +1029,7 @@ async def test_method_run_overload_4(self, async_client: AsyncCloudflare) -> Non @parametrize async def test_raw_response_run_overload_4(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.ai.with_raw_response.run( + response = await async_client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", text="x", @@ -1042,7 +1042,7 @@ async def test_raw_response_run_overload_4(self, async_client: AsyncCloudflare) @parametrize async def test_streaming_response_run_overload_4(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.ai.with_streaming_response.run( + async with async_client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", text="x", @@ -1058,14 +1058,14 @@ async def test_streaming_response_run_overload_4(self, async_client: AsyncCloudf @parametrize async def test_path_params_run_overload_4(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.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="model_name", account_id="", text="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - await async_client.workers.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", text="x", @@ -1073,7 +1073,7 @@ async def test_path_params_run_overload_4(self, async_client: AsyncCloudflare) - @parametrize async def test_method_run_overload_5(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", audio=[0], @@ -1082,7 +1082,7 @@ async def test_method_run_overload_5(self, async_client: AsyncCloudflare) -> Non @parametrize async def test_method_run_with_all_params_overload_5(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", audio=[0], @@ -1093,7 +1093,7 @@ async def test_method_run_with_all_params_overload_5(self, async_client: AsyncCl @parametrize async def test_raw_response_run_overload_5(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.ai.with_raw_response.run( + response = await async_client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", audio=[0], @@ -1106,7 +1106,7 @@ async def test_raw_response_run_overload_5(self, async_client: AsyncCloudflare) @parametrize async def test_streaming_response_run_overload_5(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.ai.with_streaming_response.run( + async with async_client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", audio=[0], @@ -1122,14 +1122,14 @@ async def test_streaming_response_run_overload_5(self, async_client: AsyncCloudf @parametrize async def test_path_params_run_overload_5(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.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="model_name", account_id="", audio=[0], ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - await async_client.workers.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", audio=[0], @@ -1137,7 +1137,7 @@ async def test_path_params_run_overload_5(self, async_client: AsyncCloudflare) - @parametrize async def test_method_run_overload_6(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], @@ -1146,7 +1146,7 @@ async def test_method_run_overload_6(self, async_client: AsyncCloudflare) -> Non @parametrize async def test_raw_response_run_overload_6(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.ai.with_raw_response.run( + response = await async_client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], @@ -1159,7 +1159,7 @@ async def test_raw_response_run_overload_6(self, async_client: AsyncCloudflare) @parametrize async def test_streaming_response_run_overload_6(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.ai.with_streaming_response.run( + async with async_client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], @@ -1175,14 +1175,14 @@ async def test_streaming_response_run_overload_6(self, async_client: AsyncCloudf @parametrize async def test_path_params_run_overload_6(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.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="model_name", account_id="", image=[0], ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - await async_client.workers.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], @@ -1190,7 +1190,7 @@ async def test_path_params_run_overload_6(self, async_client: AsyncCloudflare) - @parametrize async def test_method_run_overload_7(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -1198,7 +1198,7 @@ async def test_method_run_overload_7(self, async_client: AsyncCloudflare) -> Non @parametrize async def test_method_run_with_all_params_overload_7(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], @@ -1207,7 +1207,7 @@ async def test_method_run_with_all_params_overload_7(self, async_client: AsyncCl @parametrize async def test_raw_response_run_overload_7(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.ai.with_raw_response.run( + response = await async_client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -1219,7 +1219,7 @@ async def test_raw_response_run_overload_7(self, async_client: AsyncCloudflare) @parametrize async def test_streaming_response_run_overload_7(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.ai.with_streaming_response.run( + async with async_client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: @@ -1234,20 +1234,20 @@ async def test_streaming_response_run_overload_7(self, async_client: AsyncCloudf @parametrize async def test_path_params_run_overload_7(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.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="model_name", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - await async_client.workers.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @parametrize async def test_method_run_overload_8(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -1256,7 +1256,7 @@ async def test_method_run_overload_8(self, async_client: AsyncCloudflare) -> Non @parametrize async def test_method_run_with_all_params_overload_8(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -1276,7 +1276,7 @@ async def test_method_run_with_all_params_overload_8(self, async_client: AsyncCl @parametrize async def test_raw_response_run_overload_8(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.ai.with_raw_response.run( + response = await async_client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -1289,7 +1289,7 @@ async def test_raw_response_run_overload_8(self, async_client: AsyncCloudflare) @parametrize async def test_streaming_response_run_overload_8(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.ai.with_streaming_response.run( + async with async_client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -1305,14 +1305,14 @@ async def test_streaming_response_run_overload_8(self, async_client: AsyncCloudf @parametrize async def test_path_params_run_overload_8(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.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="model_name", account_id="", prompt="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - await async_client.workers.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", prompt="x", @@ -1320,7 +1320,7 @@ async def test_path_params_run_overload_8(self, async_client: AsyncCloudflare) - @parametrize async def test_method_run_overload_9(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", messages=[ @@ -1334,7 +1334,7 @@ async def test_method_run_overload_9(self, async_client: AsyncCloudflare) -> Non @parametrize async def test_method_run_with_all_params_overload_9(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", messages=[ @@ -1379,7 +1379,7 @@ async def test_method_run_with_all_params_overload_9(self, async_client: AsyncCl @parametrize async def test_raw_response_run_overload_9(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.ai.with_raw_response.run( + response = await async_client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", messages=[ @@ -1397,7 +1397,7 @@ async def test_raw_response_run_overload_9(self, async_client: AsyncCloudflare) @parametrize async def test_streaming_response_run_overload_9(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.ai.with_streaming_response.run( + async with async_client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", messages=[ @@ -1418,7 +1418,7 @@ async def test_streaming_response_run_overload_9(self, async_client: AsyncCloudf @parametrize async def test_path_params_run_overload_9(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.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="model_name", account_id="", messages=[ @@ -1430,7 +1430,7 @@ async def test_path_params_run_overload_9(self, async_client: AsyncCloudflare) - ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - await async_client.workers.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", messages=[ @@ -1443,7 +1443,7 @@ async def test_path_params_run_overload_9(self, async_client: AsyncCloudflare) - @parametrize async def test_method_run_overload_10(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", target_lang="target_lang", @@ -1453,7 +1453,7 @@ async def test_method_run_overload_10(self, async_client: AsyncCloudflare) -> No @parametrize async def test_method_run_with_all_params_overload_10(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", target_lang="target_lang", @@ -1464,7 +1464,7 @@ async def test_method_run_with_all_params_overload_10(self, async_client: AsyncC @parametrize async def test_raw_response_run_overload_10(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.ai.with_raw_response.run( + response = await async_client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", target_lang="target_lang", @@ -1478,7 +1478,7 @@ async def test_raw_response_run_overload_10(self, async_client: AsyncCloudflare) @parametrize async def test_streaming_response_run_overload_10(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.ai.with_streaming_response.run( + async with async_client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", target_lang="target_lang", @@ -1495,7 +1495,7 @@ async def test_streaming_response_run_overload_10(self, async_client: AsyncCloud @parametrize async def test_path_params_run_overload_10(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.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="model_name", account_id="", target_lang="target_lang", @@ -1503,7 +1503,7 @@ async def test_path_params_run_overload_10(self, async_client: AsyncCloudflare) ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - await async_client.workers.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", target_lang="target_lang", @@ -1512,7 +1512,7 @@ async def test_path_params_run_overload_10(self, async_client: AsyncCloudflare) @parametrize async def test_method_run_overload_11(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", input_text="x", @@ -1521,7 +1521,7 @@ async def test_method_run_overload_11(self, async_client: AsyncCloudflare) -> No @parametrize async def test_method_run_with_all_params_overload_11(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", input_text="x", @@ -1531,7 +1531,7 @@ async def test_method_run_with_all_params_overload_11(self, async_client: AsyncC @parametrize async def test_raw_response_run_overload_11(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.ai.with_raw_response.run( + response = await async_client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", input_text="x", @@ -1544,7 +1544,7 @@ async def test_raw_response_run_overload_11(self, async_client: AsyncCloudflare) @parametrize async def test_streaming_response_run_overload_11(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.ai.with_streaming_response.run( + async with async_client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", input_text="x", @@ -1560,14 +1560,14 @@ async def test_streaming_response_run_overload_11(self, async_client: AsyncCloud @parametrize async def test_path_params_run_overload_11(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.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="model_name", account_id="", input_text="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - await async_client.workers.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", input_text="x", @@ -1575,7 +1575,7 @@ async def test_path_params_run_overload_11(self, async_client: AsyncCloudflare) @parametrize async def test_method_run_overload_12(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], @@ -1584,7 +1584,7 @@ async def test_method_run_overload_12(self, async_client: AsyncCloudflare) -> No @parametrize async def test_method_run_with_all_params_overload_12(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( + ai = await async_client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], @@ -1597,7 +1597,7 @@ async def test_method_run_with_all_params_overload_12(self, async_client: AsyncC @parametrize async def test_raw_response_run_overload_12(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.ai.with_raw_response.run( + response = await async_client.ai.with_raw_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], @@ -1610,7 +1610,7 @@ async def test_raw_response_run_overload_12(self, async_client: AsyncCloudflare) @parametrize async def test_streaming_response_run_overload_12(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.ai.with_streaming_response.run( + async with async_client.ai.with_streaming_response.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], @@ -1626,14 +1626,14 @@ async def test_streaming_response_run_overload_12(self, async_client: AsyncCloud @parametrize async def test_path_params_run_overload_12(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.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="model_name", account_id="", image=[0], ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - await async_client.workers.ai.with_raw_response.run( + await async_client.ai.with_raw_response.run( model_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0], diff --git a/tests/api_resources/test_ai_gateway.py b/tests/api_resources/test_ai_gateway.py index 8c33ce4e9fa..410c03d585f 100644 --- a/tests/api_resources/test_ai_gateway.py +++ b/tests/api_resources/test_ai_gateway.py @@ -211,8 +211,6 @@ def test_method_list(self, client: Cloudflare) -> None: def test_method_list_with_all_params(self, client: Cloudflare) -> None: ai_gateway = client.ai_gateway.list( account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", - order_by="order_by", - order_by_direction="asc", page=1, per_page=1, search="search", @@ -537,8 +535,6 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: ai_gateway = await async_client.ai_gateway.list( account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", - order_by="order_by", - order_by_direction="asc", page=1, per_page=1, search="search", diff --git a/tests/api_resources/test_filters.py b/tests/api_resources/test_filters.py index eb126fb8162..c85398c274e 100644 --- a/tests/api_resources/test_filters.py +++ b/tests/api_resources/test_filters.py @@ -293,6 +293,7 @@ def test_path_params_bulk_delete(self, client: Cloudflare) -> None: zone_id="", ) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_bulk_update(self, client: Cloudflare) -> None: with pytest.warns(DeprecationWarning): @@ -302,6 +303,7 @@ def test_method_bulk_update(self, client: Cloudflare) -> None: assert_matches_type(Optional[FilterBulkUpdateResponse], filter, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_raw_response_bulk_update(self, client: Cloudflare) -> None: with pytest.warns(DeprecationWarning): @@ -314,6 +316,7 @@ def test_raw_response_bulk_update(self, client: Cloudflare) -> None: filter = response.parse() assert_matches_type(Optional[FilterBulkUpdateResponse], filter, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_streaming_response_bulk_update(self, client: Cloudflare) -> None: with pytest.warns(DeprecationWarning): @@ -328,6 +331,7 @@ def test_streaming_response_bulk_update(self, client: Cloudflare) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_bulk_update(self, client: Cloudflare) -> None: with pytest.warns(DeprecationWarning): @@ -661,6 +665,7 @@ async def test_path_params_bulk_delete(self, async_client: AsyncCloudflare) -> N zone_id="", ) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_bulk_update(self, async_client: AsyncCloudflare) -> None: with pytest.warns(DeprecationWarning): @@ -670,6 +675,7 @@ async def test_method_bulk_update(self, async_client: AsyncCloudflare) -> None: assert_matches_type(Optional[FilterBulkUpdateResponse], filter, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_raw_response_bulk_update(self, async_client: AsyncCloudflare) -> None: with pytest.warns(DeprecationWarning): @@ -682,6 +688,7 @@ async def test_raw_response_bulk_update(self, async_client: AsyncCloudflare) -> filter = await response.parse() assert_matches_type(Optional[FilterBulkUpdateResponse], filter, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_streaming_response_bulk_update(self, async_client: AsyncCloudflare) -> None: with pytest.warns(DeprecationWarning): @@ -696,6 +703,7 @@ async def test_streaming_response_bulk_update(self, async_client: AsyncCloudflar assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_bulk_update(self, async_client: AsyncCloudflare) -> None: with pytest.warns(DeprecationWarning): diff --git a/tests/api_resources/test_managed_transforms.py b/tests/api_resources/test_managed_transforms.py index 895eb3ee9fa..f00cf76c8b0 100644 --- a/tests/api_resources/test_managed_transforms.py +++ b/tests/api_resources/test_managed_transforms.py @@ -20,17 +20,19 @@ class TestManagedTransforms: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize def test_method_list(self, client: Cloudflare) -> None: managed_transform = client.managed_transforms.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="9f1839b6152d298aca64c4e906b6d074", ) assert_matches_type(ManagedTransformListResponse, managed_transform, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.managed_transforms.with_raw_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="9f1839b6152d298aca64c4e906b6d074", ) assert response.is_closed is True @@ -38,10 +40,11 @@ def test_raw_response_list(self, client: Cloudflare) -> None: managed_transform = response.parse() assert_matches_type(ManagedTransformListResponse, managed_transform, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: with client.managed_transforms.with_streaming_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="9f1839b6152d298aca64c4e906b6d074", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -51,6 +54,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize def test_path_params_list(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): @@ -58,21 +62,85 @@ def test_path_params_list(self, client: Cloudflare) -> None: zone_id="", ) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + def test_method_delete(self, client: Cloudflare) -> None: + managed_transform = client.managed_transforms.delete( + zone_id="9f1839b6152d298aca64c4e906b6d074", + ) + assert managed_transform is None + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + def test_raw_response_delete(self, client: Cloudflare) -> None: + response = client.managed_transforms.with_raw_response.delete( + zone_id="9f1839b6152d298aca64c4e906b6d074", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + managed_transform = response.parse() + assert managed_transform is None + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + def test_streaming_response_delete(self, client: Cloudflare) -> None: + with client.managed_transforms.with_streaming_response.delete( + zone_id="9f1839b6152d298aca64c4e906b6d074", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + managed_transform = response.parse() + assert managed_transform is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + def test_path_params_delete(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.managed_transforms.with_raw_response.delete( + zone_id="", + ) + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize def test_method_edit(self, client: Cloudflare) -> None: managed_transform = client.managed_transforms.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - managed_request_headers=[{}], - managed_response_headers=[{}], + zone_id="9f1839b6152d298aca64c4e906b6d074", + managed_request_headers=[ + { + "id": "add_bot_protection_headers", + "enabled": True, + } + ], + managed_response_headers=[ + { + "id": "add_security_headers", + "enabled": True, + } + ], ) assert_matches_type(ManagedTransformEditResponse, managed_transform, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: response = client.managed_transforms.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - managed_request_headers=[{}], - managed_response_headers=[{}], + zone_id="9f1839b6152d298aca64c4e906b6d074", + managed_request_headers=[ + { + "id": "add_bot_protection_headers", + "enabled": True, + } + ], + managed_response_headers=[ + { + "id": "add_security_headers", + "enabled": True, + } + ], ) assert response.is_closed is True @@ -80,12 +148,23 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: managed_transform = response.parse() assert_matches_type(ManagedTransformEditResponse, managed_transform, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: with client.managed_transforms.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - managed_request_headers=[{}], - managed_response_headers=[{}], + zone_id="9f1839b6152d298aca64c4e906b6d074", + managed_request_headers=[ + { + "id": "add_bot_protection_headers", + "enabled": True, + } + ], + managed_response_headers=[ + { + "id": "add_security_headers", + "enabled": True, + } + ], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -95,30 +174,43 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize def test_path_params_edit(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.managed_transforms.with_raw_response.edit( zone_id="", - managed_request_headers=[{}], - managed_response_headers=[{}], + managed_request_headers=[ + { + "id": "add_bot_protection_headers", + "enabled": True, + } + ], + managed_response_headers=[ + { + "id": "add_security_headers", + "enabled": True, + } + ], ) class TestAsyncManagedTransforms: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: managed_transform = await async_client.managed_transforms.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="9f1839b6152d298aca64c4e906b6d074", ) assert_matches_type(ManagedTransformListResponse, managed_transform, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.managed_transforms.with_raw_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="9f1839b6152d298aca64c4e906b6d074", ) assert response.is_closed is True @@ -126,10 +218,11 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: managed_transform = await response.parse() assert_matches_type(ManagedTransformListResponse, managed_transform, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: async with async_client.managed_transforms.with_streaming_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="9f1839b6152d298aca64c4e906b6d074", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -139,6 +232,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): @@ -146,21 +240,85 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: zone_id="", ) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + async def test_method_delete(self, async_client: AsyncCloudflare) -> None: + managed_transform = await async_client.managed_transforms.delete( + zone_id="9f1839b6152d298aca64c4e906b6d074", + ) + assert managed_transform is None + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: + response = await async_client.managed_transforms.with_raw_response.delete( + zone_id="9f1839b6152d298aca64c4e906b6d074", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + managed_transform = await response.parse() + assert managed_transform is None + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: + async with async_client.managed_transforms.with_streaming_response.delete( + zone_id="9f1839b6152d298aca64c4e906b6d074", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + managed_transform = await response.parse() + assert managed_transform is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.managed_transforms.with_raw_response.delete( + zone_id="", + ) + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize async def test_method_edit(self, async_client: AsyncCloudflare) -> None: managed_transform = await async_client.managed_transforms.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - managed_request_headers=[{}], - managed_response_headers=[{}], + zone_id="9f1839b6152d298aca64c4e906b6d074", + managed_request_headers=[ + { + "id": "add_bot_protection_headers", + "enabled": True, + } + ], + managed_response_headers=[ + { + "id": "add_security_headers", + "enabled": True, + } + ], ) assert_matches_type(ManagedTransformEditResponse, managed_transform, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: response = await async_client.managed_transforms.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - managed_request_headers=[{}], - managed_response_headers=[{}], + zone_id="9f1839b6152d298aca64c4e906b6d074", + managed_request_headers=[ + { + "id": "add_bot_protection_headers", + "enabled": True, + } + ], + managed_response_headers=[ + { + "id": "add_security_headers", + "enabled": True, + } + ], ) assert response.is_closed is True @@ -168,12 +326,23 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: managed_transform = await response.parse() assert_matches_type(ManagedTransformEditResponse, managed_transform, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: async with async_client.managed_transforms.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - managed_request_headers=[{}], - managed_response_headers=[{}], + zone_id="9f1839b6152d298aca64c4e906b6d074", + managed_request_headers=[ + { + "id": "add_bot_protection_headers", + "enabled": True, + } + ], + managed_response_headers=[ + { + "id": "add_security_headers", + "enabled": True, + } + ], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -183,11 +352,22 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.managed_transforms.with_raw_response.edit( zone_id="", - managed_request_headers=[{}], - managed_response_headers=[{}], + managed_request_headers=[ + { + "id": "add_bot_protection_headers", + "enabled": True, + } + ], + managed_response_headers=[ + { + "id": "add_security_headers", + "enabled": True, + } + ], ) diff --git a/tests/api_resources/test_origin_post_quantum_encryption.py b/tests/api_resources/test_origin_post_quantum_encryption.py index 7b671649427..5be62d7556c 100644 --- a/tests/api_resources/test_origin_post_quantum_encryption.py +++ b/tests/api_resources/test_origin_post_quantum_encryption.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -28,7 +28,7 @@ def test_method_update(self, client: Cloudflare) -> None: value="preferred", ) assert_matches_type( - OriginPostQuantumEncryptionUpdateResponse, origin_post_quantum_encryption, path=["response"] + Optional[OriginPostQuantumEncryptionUpdateResponse], origin_post_quantum_encryption, path=["response"] ) @pytest.mark.skip(reason="TODO: investigate broken test") @@ -43,7 +43,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_post_quantum_encryption = response.parse() assert_matches_type( - OriginPostQuantumEncryptionUpdateResponse, origin_post_quantum_encryption, path=["response"] + Optional[OriginPostQuantumEncryptionUpdateResponse], origin_post_quantum_encryption, path=["response"] ) @pytest.mark.skip(reason="TODO: investigate broken test") @@ -58,7 +58,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: origin_post_quantum_encryption = response.parse() assert_matches_type( - OriginPostQuantumEncryptionUpdateResponse, origin_post_quantum_encryption, path=["response"] + Optional[OriginPostQuantumEncryptionUpdateResponse], origin_post_quantum_encryption, path=["response"] ) assert cast(Any, response.is_closed) is True @@ -78,7 +78,9 @@ def test_method_get(self, client: Cloudflare) -> None: origin_post_quantum_encryption = client.origin_post_quantum_encryption.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(OriginPostQuantumEncryptionGetResponse, origin_post_quantum_encryption, path=["response"]) + assert_matches_type( + Optional[OriginPostQuantumEncryptionGetResponse], origin_post_quantum_encryption, path=["response"] + ) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -90,7 +92,9 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_post_quantum_encryption = response.parse() - assert_matches_type(OriginPostQuantumEncryptionGetResponse, origin_post_quantum_encryption, path=["response"]) + assert_matches_type( + Optional[OriginPostQuantumEncryptionGetResponse], origin_post_quantum_encryption, path=["response"] + ) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -103,7 +107,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: origin_post_quantum_encryption = response.parse() assert_matches_type( - OriginPostQuantumEncryptionGetResponse, origin_post_quantum_encryption, path=["response"] + Optional[OriginPostQuantumEncryptionGetResponse], origin_post_quantum_encryption, path=["response"] ) assert cast(Any, response.is_closed) is True @@ -128,7 +132,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: value="preferred", ) assert_matches_type( - OriginPostQuantumEncryptionUpdateResponse, origin_post_quantum_encryption, path=["response"] + Optional[OriginPostQuantumEncryptionUpdateResponse], origin_post_quantum_encryption, path=["response"] ) @pytest.mark.skip(reason="TODO: investigate broken test") @@ -143,7 +147,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_post_quantum_encryption = await response.parse() assert_matches_type( - OriginPostQuantumEncryptionUpdateResponse, origin_post_quantum_encryption, path=["response"] + Optional[OriginPostQuantumEncryptionUpdateResponse], origin_post_quantum_encryption, path=["response"] ) @pytest.mark.skip(reason="TODO: investigate broken test") @@ -158,7 +162,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> origin_post_quantum_encryption = await response.parse() assert_matches_type( - OriginPostQuantumEncryptionUpdateResponse, origin_post_quantum_encryption, path=["response"] + Optional[OriginPostQuantumEncryptionUpdateResponse], origin_post_quantum_encryption, path=["response"] ) assert cast(Any, response.is_closed) is True @@ -178,7 +182,9 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: origin_post_quantum_encryption = await async_client.origin_post_quantum_encryption.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(OriginPostQuantumEncryptionGetResponse, origin_post_quantum_encryption, path=["response"]) + assert_matches_type( + Optional[OriginPostQuantumEncryptionGetResponse], origin_post_quantum_encryption, path=["response"] + ) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -190,7 +196,9 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_post_quantum_encryption = await response.parse() - assert_matches_type(OriginPostQuantumEncryptionGetResponse, origin_post_quantum_encryption, path=["response"]) + assert_matches_type( + Optional[OriginPostQuantumEncryptionGetResponse], origin_post_quantum_encryption, path=["response"] + ) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -203,7 +211,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No origin_post_quantum_encryption = await response.parse() assert_matches_type( - OriginPostQuantumEncryptionGetResponse, origin_post_quantum_encryption, path=["response"] + Optional[OriginPostQuantumEncryptionGetResponse], origin_post_quantum_encryption, path=["response"] ) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_url_normalization.py b/tests/api_resources/test_url_normalization.py index bd0ad470a31..961a3f7b78d 100644 --- a/tests/api_resources/test_url_normalization.py +++ b/tests/api_resources/test_url_normalization.py @@ -20,26 +20,23 @@ class TestURLNormalization: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize def test_method_update(self, client: Cloudflare) -> None: url_normalization = client.url_normalization.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(URLNormalizationUpdateResponse, url_normalization, path=["response"]) - - @parametrize - def test_method_update_with_all_params(self, client: Cloudflare) -> None: - url_normalization = client.url_normalization.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="9f1839b6152d298aca64c4e906b6d074", scope="incoming", type="cloudflare", ) assert_matches_type(URLNormalizationUpdateResponse, url_normalization, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: response = client.url_normalization.with_raw_response.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="9f1839b6152d298aca64c4e906b6d074", + scope="incoming", + type="cloudflare", ) assert response.is_closed is True @@ -47,10 +44,13 @@ def test_raw_response_update(self, client: Cloudflare) -> None: url_normalization = response.parse() assert_matches_type(URLNormalizationUpdateResponse, url_normalization, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: with client.url_normalization.with_streaming_response.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="9f1839b6152d298aca64c4e906b6d074", + scope="incoming", + type="cloudflare", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -60,24 +60,71 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.url_normalization.with_raw_response.update( zone_id="", + scope="incoming", + type="cloudflare", + ) + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + def test_method_delete(self, client: Cloudflare) -> None: + url_normalization = client.url_normalization.delete( + zone_id="9f1839b6152d298aca64c4e906b6d074", + ) + assert url_normalization is None + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + def test_raw_response_delete(self, client: Cloudflare) -> None: + response = client.url_normalization.with_raw_response.delete( + zone_id="9f1839b6152d298aca64c4e906b6d074", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + url_normalization = response.parse() + assert url_normalization is None + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + def test_streaming_response_delete(self, client: Cloudflare) -> None: + with client.url_normalization.with_streaming_response.delete( + zone_id="9f1839b6152d298aca64c4e906b6d074", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + url_normalization = response.parse() + assert url_normalization is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + def test_path_params_delete(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.url_normalization.with_raw_response.delete( + zone_id="", ) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize def test_method_get(self, client: Cloudflare) -> None: url_normalization = client.url_normalization.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="9f1839b6152d298aca64c4e906b6d074", ) assert_matches_type(URLNormalizationGetResponse, url_normalization, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.url_normalization.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="9f1839b6152d298aca64c4e906b6d074", ) assert response.is_closed is True @@ -85,10 +132,11 @@ def test_raw_response_get(self, client: Cloudflare) -> None: url_normalization = response.parse() assert_matches_type(URLNormalizationGetResponse, url_normalization, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.url_normalization.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="9f1839b6152d298aca64c4e906b6d074", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -98,6 +146,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize def test_path_params_get(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): @@ -109,26 +158,23 @@ def test_path_params_get(self, client: Cloudflare) -> None: class TestAsyncURLNormalization: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize async def test_method_update(self, async_client: AsyncCloudflare) -> None: url_normalization = await async_client.url_normalization.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(URLNormalizationUpdateResponse, url_normalization, path=["response"]) - - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - url_normalization = await async_client.url_normalization.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="9f1839b6152d298aca64c4e906b6d074", scope="incoming", type="cloudflare", ) assert_matches_type(URLNormalizationUpdateResponse, url_normalization, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.url_normalization.with_raw_response.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="9f1839b6152d298aca64c4e906b6d074", + scope="incoming", + type="cloudflare", ) assert response.is_closed is True @@ -136,10 +182,13 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: url_normalization = await response.parse() assert_matches_type(URLNormalizationUpdateResponse, url_normalization, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.url_normalization.with_streaming_response.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="9f1839b6152d298aca64c4e906b6d074", + scope="incoming", + type="cloudflare", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -149,24 +198,71 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.url_normalization.with_raw_response.update( zone_id="", + scope="incoming", + type="cloudflare", + ) + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + async def test_method_delete(self, async_client: AsyncCloudflare) -> None: + url_normalization = await async_client.url_normalization.delete( + zone_id="9f1839b6152d298aca64c4e906b6d074", + ) + assert url_normalization is None + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: + response = await async_client.url_normalization.with_raw_response.delete( + zone_id="9f1839b6152d298aca64c4e906b6d074", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + url_normalization = await response.parse() + assert url_normalization is None + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: + async with async_client.url_normalization.with_streaming_response.delete( + zone_id="9f1839b6152d298aca64c4e906b6d074", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + url_normalization = await response.parse() + assert url_normalization is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") + @parametrize + async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.url_normalization.with_raw_response.delete( + zone_id="", ) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: url_normalization = await async_client.url_normalization.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="9f1839b6152d298aca64c4e906b6d074", ) assert_matches_type(URLNormalizationGetResponse, url_normalization, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.url_normalization.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="9f1839b6152d298aca64c4e906b6d074", ) assert response.is_closed is True @@ -174,10 +270,11 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: url_normalization = await response.parse() assert_matches_type(URLNormalizationGetResponse, url_normalization, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.url_normalization.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="9f1839b6152d298aca64c4e906b6d074", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -187,6 +284,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate unauthorized HTTP response") @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): diff --git a/tests/api_resources/test_waiting_rooms.py b/tests/api_resources/test_waiting_rooms.py index fb3506d55e7..73949870677 100644 --- a/tests/api_resources/test_waiting_rooms.py +++ b/tests/api_resources/test_waiting_rooms.py @@ -63,6 +63,8 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: queueing_status_code=200, session_duration=1, suspended=True, + turnstile_action="log", + turnstile_mode="off", ) assert_matches_type(WaitingRoom, waiting_room, path=["response"]) @@ -153,6 +155,8 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: queueing_status_code=200, session_duration=1, suspended=True, + turnstile_action="log", + turnstile_mode="off", ) assert_matches_type(WaitingRoom, waiting_room, path=["response"]) @@ -351,6 +355,8 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: queueing_status_code=200, session_duration=1, suspended=True, + turnstile_action="log", + turnstile_mode="off", ) assert_matches_type(WaitingRoom, waiting_room, path=["response"]) @@ -504,6 +510,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare queueing_status_code=200, session_duration=1, suspended=True, + turnstile_action="log", + turnstile_mode="off", ) assert_matches_type(WaitingRoom, waiting_room, path=["response"]) @@ -594,6 +602,8 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare queueing_status_code=200, session_duration=1, suspended=True, + turnstile_action="log", + turnstile_mode="off", ) assert_matches_type(WaitingRoom, waiting_room, path=["response"]) @@ -792,6 +802,8 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) queueing_status_code=200, session_duration=1, suspended=True, + turnstile_action="log", + turnstile_mode="off", ) assert_matches_type(WaitingRoom, waiting_room, path=["response"]) diff --git a/tests/api_resources/url_scanner/test_responses.py b/tests/api_resources/url_scanner/test_responses.py index 5fe0f1eb19e..1690ba966df 100644 --- a/tests/api_resources/url_scanner/test_responses.py +++ b/tests/api_resources/url_scanner/test_responses.py @@ -19,16 +19,16 @@ class TestResponses: @parametrize def test_method_get(self, client: Cloudflare) -> None: response = client.url_scanner.responses.get( - response_id="responseId", - account_id="accountId", + response_id="response_id", + account_id="account_id", ) assert_matches_type(str, response, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: http_response = client.url_scanner.responses.with_raw_response.get( - response_id="responseId", - account_id="accountId", + response_id="response_id", + account_id="account_id", ) assert http_response.is_closed is True @@ -39,8 +39,8 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.url_scanner.responses.with_streaming_response.get( - response_id="responseId", - account_id="accountId", + response_id="response_id", + account_id="account_id", ) as http_response: assert not http_response.is_closed assert http_response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -54,14 +54,14 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: 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.url_scanner.responses.with_raw_response.get( - response_id="responseId", + response_id="response_id", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `response_id` but received ''"): client.url_scanner.responses.with_raw_response.get( response_id="", - account_id="accountId", + account_id="account_id", ) @@ -71,16 +71,16 @@ class TestAsyncResponses: @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.url_scanner.responses.get( - response_id="responseId", - account_id="accountId", + response_id="response_id", + account_id="account_id", ) assert_matches_type(str, response, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: http_response = await async_client.url_scanner.responses.with_raw_response.get( - response_id="responseId", - account_id="accountId", + response_id="response_id", + account_id="account_id", ) assert http_response.is_closed is True @@ -91,8 +91,8 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.url_scanner.responses.with_streaming_response.get( - response_id="responseId", - account_id="accountId", + response_id="response_id", + account_id="account_id", ) as http_response: assert not http_response.is_closed assert http_response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -106,12 +106,12 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No 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.url_scanner.responses.with_raw_response.get( - response_id="responseId", + response_id="response_id", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `response_id` but received ''"): await async_client.url_scanner.responses.with_raw_response.get( response_id="", - account_id="accountId", + account_id="account_id", ) diff --git a/tests/api_resources/url_scanner/test_scans.py b/tests/api_resources/url_scanner/test_scans.py index eb8d6e905a9..aaa1385a9bb 100644 --- a/tests/api_resources/url_scanner/test_scans.py +++ b/tests/api_resources/url_scanner/test_scans.py @@ -33,7 +33,7 @@ class TestScans: @parametrize def test_method_create(self, client: Cloudflare) -> None: scan = client.url_scanner.scans.create( - account_id="accountId", + account_id="account_id", url="https://www.example.com", ) assert_matches_type(str, scan, path=["response"]) @@ -41,7 +41,7 @@ def test_method_create(self, client: Cloudflare) -> None: @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: scan = client.url_scanner.scans.create( - account_id="accountId", + account_id="account_id", url="https://www.example.com", customagent="customagent", custom_headers={"foo": "string"}, @@ -54,7 +54,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.url_scanner.scans.with_raw_response.create( - account_id="accountId", + account_id="account_id", url="https://www.example.com", ) @@ -66,7 +66,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.url_scanner.scans.with_streaming_response.create( - account_id="accountId", + account_id="account_id", url="https://www.example.com", ) as response: assert not response.is_closed @@ -88,14 +88,14 @@ def test_path_params_create(self, client: Cloudflare) -> None: @parametrize def test_method_list(self, client: Cloudflare) -> None: scan = client.url_scanner.scans.list( - account_id="accountId", + account_id="account_id", ) assert_matches_type(ScanListResponse, scan, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: scan = client.url_scanner.scans.list( - account_id="accountId", + account_id="account_id", q="q", size=100, ) @@ -104,7 +104,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.url_scanner.scans.with_raw_response.list( - account_id="accountId", + account_id="account_id", ) assert response.is_closed is True @@ -115,7 +115,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: with client.url_scanner.scans.with_streaming_response.list( - account_id="accountId", + account_id="account_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -135,7 +135,7 @@ def test_path_params_list(self, client: Cloudflare) -> None: @parametrize def test_method_bulk_create(self, client: Cloudflare) -> None: scan = client.url_scanner.scans.bulk_create( - account_id="accountId", + account_id="account_id", body=[{"url": "https://www.example.com"}], ) assert_matches_type(ScanBulkCreateResponse, scan, path=["response"]) @@ -143,7 +143,7 @@ def test_method_bulk_create(self, client: Cloudflare) -> None: @parametrize def test_raw_response_bulk_create(self, client: Cloudflare) -> None: response = client.url_scanner.scans.with_raw_response.bulk_create( - account_id="accountId", + account_id="account_id", body=[{"url": "https://www.example.com"}], ) @@ -155,7 +155,7 @@ def test_raw_response_bulk_create(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_bulk_create(self, client: Cloudflare) -> None: with client.url_scanner.scans.with_streaming_response.bulk_create( - account_id="accountId", + account_id="account_id", body=[{"url": "https://www.example.com"}], ) as response: assert not response.is_closed @@ -178,7 +178,7 @@ def test_path_params_bulk_create(self, client: Cloudflare) -> None: def test_method_dom(self, client: Cloudflare) -> None: scan = client.url_scanner.scans.dom( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) assert_matches_type(str, scan, path=["response"]) @@ -186,7 +186,7 @@ def test_method_dom(self, client: Cloudflare) -> None: def test_raw_response_dom(self, client: Cloudflare) -> None: response = client.url_scanner.scans.with_raw_response.dom( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) assert response.is_closed is True @@ -198,7 +198,7 @@ def test_raw_response_dom(self, client: Cloudflare) -> None: def test_streaming_response_dom(self, client: Cloudflare) -> None: with client.url_scanner.scans.with_streaming_response.dom( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -219,22 +219,24 @@ def test_path_params_dom(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): client.url_scanner.scans.with_raw_response.dom( scan_id="", - account_id="accountId", + account_id="account_id", ) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_get(self, client: Cloudflare) -> None: scan = client.url_scanner.scans.get( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) assert_matches_type(ScanGetResponse, scan, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.url_scanner.scans.with_raw_response.get( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) assert response.is_closed is True @@ -242,11 +244,12 @@ def test_raw_response_get(self, client: Cloudflare) -> None: scan = response.parse() assert_matches_type(ScanGetResponse, scan, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.url_scanner.scans.with_streaming_response.get( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -256,6 +259,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate broken test") @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 ''"): @@ -267,14 +271,14 @@ def test_path_params_get(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): client.url_scanner.scans.with_raw_response.get( scan_id="", - account_id="accountId", + account_id="account_id", ) @parametrize def test_method_har(self, client: Cloudflare) -> None: scan = client.url_scanner.scans.har( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) assert_matches_type(ScanHARResponse, scan, path=["response"]) @@ -282,7 +286,7 @@ def test_method_har(self, client: Cloudflare) -> None: def test_raw_response_har(self, client: Cloudflare) -> None: response = client.url_scanner.scans.with_raw_response.har( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) assert response.is_closed is True @@ -294,7 +298,7 @@ def test_raw_response_har(self, client: Cloudflare) -> None: def test_streaming_response_har(self, client: Cloudflare) -> None: with client.url_scanner.scans.with_streaming_response.har( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -315,18 +319,18 @@ def test_path_params_har(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): client.url_scanner.scans.with_raw_response.har( scan_id="", - account_id="accountId", + account_id="account_id", ) @parametrize @pytest.mark.respx(base_url=base_url) def test_method_screenshot(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/accounts/accountId/urlscanner/v2/screenshots/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e.png").mock( + respx_mock.get("/accounts/account_id/urlscanner/v2/screenshots/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e.png").mock( return_value=httpx.Response(200, json={"foo": "bar"}) ) scan = client.url_scanner.scans.screenshot( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) assert scan.is_closed assert scan.json() == {"foo": "bar"} @@ -336,12 +340,12 @@ def test_method_screenshot(self, client: Cloudflare, respx_mock: MockRouter) -> @parametrize @pytest.mark.respx(base_url=base_url) def test_method_screenshot_with_all_params(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/accounts/accountId/urlscanner/v2/screenshots/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e.png").mock( + respx_mock.get("/accounts/account_id/urlscanner/v2/screenshots/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e.png").mock( return_value=httpx.Response(200, json={"foo": "bar"}) ) scan = client.url_scanner.scans.screenshot( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", resolution="desktop", ) assert scan.is_closed @@ -352,13 +356,13 @@ def test_method_screenshot_with_all_params(self, client: Cloudflare, respx_mock: @parametrize @pytest.mark.respx(base_url=base_url) def test_raw_response_screenshot(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/accounts/accountId/urlscanner/v2/screenshots/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e.png").mock( + respx_mock.get("/accounts/account_id/urlscanner/v2/screenshots/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e.png").mock( return_value=httpx.Response(200, json={"foo": "bar"}) ) scan = client.url_scanner.scans.with_raw_response.screenshot( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) assert scan.is_closed is True @@ -369,12 +373,12 @@ def test_raw_response_screenshot(self, client: Cloudflare, respx_mock: MockRoute @parametrize @pytest.mark.respx(base_url=base_url) def test_streaming_response_screenshot(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/accounts/accountId/urlscanner/v2/screenshots/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e.png").mock( + respx_mock.get("/accounts/account_id/urlscanner/v2/screenshots/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e.png").mock( return_value=httpx.Response(200, json={"foo": "bar"}) ) with client.url_scanner.scans.with_streaming_response.screenshot( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) as scan: assert not scan.is_closed assert scan.http_request.headers.get("X-Stainless-Lang") == "python" @@ -397,7 +401,7 @@ def test_path_params_screenshot(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): client.url_scanner.scans.with_raw_response.screenshot( scan_id="", - account_id="accountId", + account_id="account_id", ) @@ -407,7 +411,7 @@ class TestAsyncScans: @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: scan = await async_client.url_scanner.scans.create( - account_id="accountId", + account_id="account_id", url="https://www.example.com", ) assert_matches_type(str, scan, path=["response"]) @@ -415,7 +419,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: scan = await async_client.url_scanner.scans.create( - account_id="accountId", + account_id="account_id", url="https://www.example.com", customagent="customagent", custom_headers={"foo": "string"}, @@ -428,7 +432,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.url_scanner.scans.with_raw_response.create( - account_id="accountId", + account_id="account_id", url="https://www.example.com", ) @@ -440,7 +444,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.url_scanner.scans.with_streaming_response.create( - account_id="accountId", + account_id="account_id", url="https://www.example.com", ) as response: assert not response.is_closed @@ -462,14 +466,14 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: scan = await async_client.url_scanner.scans.list( - account_id="accountId", + account_id="account_id", ) assert_matches_type(ScanListResponse, scan, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: scan = await async_client.url_scanner.scans.list( - account_id="accountId", + account_id="account_id", q="q", size=100, ) @@ -478,7 +482,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.url_scanner.scans.with_raw_response.list( - account_id="accountId", + account_id="account_id", ) assert response.is_closed is True @@ -489,7 +493,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: async with async_client.url_scanner.scans.with_streaming_response.list( - account_id="accountId", + account_id="account_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -509,7 +513,7 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_bulk_create(self, async_client: AsyncCloudflare) -> None: scan = await async_client.url_scanner.scans.bulk_create( - account_id="accountId", + account_id="account_id", body=[{"url": "https://www.example.com"}], ) assert_matches_type(ScanBulkCreateResponse, scan, path=["response"]) @@ -517,7 +521,7 @@ async def test_method_bulk_create(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_raw_response_bulk_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.url_scanner.scans.with_raw_response.bulk_create( - account_id="accountId", + account_id="account_id", body=[{"url": "https://www.example.com"}], ) @@ -529,7 +533,7 @@ async def test_raw_response_bulk_create(self, async_client: AsyncCloudflare) -> @parametrize async def test_streaming_response_bulk_create(self, async_client: AsyncCloudflare) -> None: async with async_client.url_scanner.scans.with_streaming_response.bulk_create( - account_id="accountId", + account_id="account_id", body=[{"url": "https://www.example.com"}], ) as response: assert not response.is_closed @@ -552,7 +556,7 @@ async def test_path_params_bulk_create(self, async_client: AsyncCloudflare) -> N async def test_method_dom(self, async_client: AsyncCloudflare) -> None: scan = await async_client.url_scanner.scans.dom( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) assert_matches_type(str, scan, path=["response"]) @@ -560,7 +564,7 @@ async def test_method_dom(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_dom(self, async_client: AsyncCloudflare) -> None: response = await async_client.url_scanner.scans.with_raw_response.dom( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) assert response.is_closed is True @@ -572,7 +576,7 @@ async def test_raw_response_dom(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_dom(self, async_client: AsyncCloudflare) -> None: async with async_client.url_scanner.scans.with_streaming_response.dom( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -593,22 +597,24 @@ async def test_path_params_dom(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): await async_client.url_scanner.scans.with_raw_response.dom( scan_id="", - account_id="accountId", + account_id="account_id", ) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: scan = await async_client.url_scanner.scans.get( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) assert_matches_type(ScanGetResponse, scan, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.url_scanner.scans.with_raw_response.get( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) assert response.is_closed is True @@ -616,11 +622,12 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: scan = await response.parse() assert_matches_type(ScanGetResponse, scan, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.url_scanner.scans.with_streaming_response.get( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -630,6 +637,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate broken test") @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 ''"): @@ -641,14 +649,14 @@ async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): await async_client.url_scanner.scans.with_raw_response.get( scan_id="", - account_id="accountId", + account_id="account_id", ) @parametrize async def test_method_har(self, async_client: AsyncCloudflare) -> None: scan = await async_client.url_scanner.scans.har( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) assert_matches_type(ScanHARResponse, scan, path=["response"]) @@ -656,7 +664,7 @@ async def test_method_har(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_har(self, async_client: AsyncCloudflare) -> None: response = await async_client.url_scanner.scans.with_raw_response.har( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) assert response.is_closed is True @@ -668,7 +676,7 @@ async def test_raw_response_har(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_har(self, async_client: AsyncCloudflare) -> None: async with async_client.url_scanner.scans.with_streaming_response.har( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -689,18 +697,18 @@ async def test_path_params_har(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): await async_client.url_scanner.scans.with_raw_response.har( scan_id="", - account_id="accountId", + account_id="account_id", ) @parametrize @pytest.mark.respx(base_url=base_url) async def test_method_screenshot(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/accounts/accountId/urlscanner/v2/screenshots/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e.png").mock( + respx_mock.get("/accounts/account_id/urlscanner/v2/screenshots/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e.png").mock( return_value=httpx.Response(200, json={"foo": "bar"}) ) scan = await async_client.url_scanner.scans.screenshot( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) assert scan.is_closed assert await scan.json() == {"foo": "bar"} @@ -712,12 +720,12 @@ async def test_method_screenshot(self, async_client: AsyncCloudflare, respx_mock async def test_method_screenshot_with_all_params( self, async_client: AsyncCloudflare, respx_mock: MockRouter ) -> None: - respx_mock.get("/accounts/accountId/urlscanner/v2/screenshots/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e.png").mock( + respx_mock.get("/accounts/account_id/urlscanner/v2/screenshots/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e.png").mock( return_value=httpx.Response(200, json={"foo": "bar"}) ) scan = await async_client.url_scanner.scans.screenshot( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", resolution="desktop", ) assert scan.is_closed @@ -728,13 +736,13 @@ async def test_method_screenshot_with_all_params( @parametrize @pytest.mark.respx(base_url=base_url) async def test_raw_response_screenshot(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/accounts/accountId/urlscanner/v2/screenshots/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e.png").mock( + respx_mock.get("/accounts/account_id/urlscanner/v2/screenshots/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e.png").mock( return_value=httpx.Response(200, json={"foo": "bar"}) ) scan = await async_client.url_scanner.scans.with_raw_response.screenshot( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) assert scan.is_closed is True @@ -745,12 +753,12 @@ async def test_raw_response_screenshot(self, async_client: AsyncCloudflare, resp @parametrize @pytest.mark.respx(base_url=base_url) async def test_streaming_response_screenshot(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/accounts/accountId/urlscanner/v2/screenshots/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e.png").mock( + respx_mock.get("/accounts/account_id/urlscanner/v2/screenshots/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e.png").mock( return_value=httpx.Response(200, json={"foo": "bar"}) ) async with async_client.url_scanner.scans.with_streaming_response.screenshot( scan_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="accountId", + account_id="account_id", ) as scan: assert not scan.is_closed assert scan.http_request.headers.get("X-Stainless-Lang") == "python" @@ -773,5 +781,5 @@ async def test_path_params_screenshot(self, async_client: AsyncCloudflare) -> No with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): await async_client.url_scanner.scans.with_raw_response.screenshot( scan_id="", - account_id="accountId", + account_id="account_id", ) diff --git a/tests/api_resources/user/test_tokens.py b/tests/api_resources/user/test_tokens.py index 81169dc8e56..3ad7952d607 100644 --- a/tests/api_resources/user/test_tokens.py +++ b/tests/api_resources/user/test_tokens.py @@ -33,7 +33,10 @@ def test_method_create(self, client: Cloudflare) -> None: { "effect": "allow", "permission_groups": [{}, {}], - "resources": {}, + "resources": { + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }, } ], ) @@ -62,8 +65,8 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: }, ], "resources": { - "resource": "resource", - "scope": "scope", + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", }, } ], @@ -87,7 +90,10 @@ def test_raw_response_create(self, client: Cloudflare) -> None: { "effect": "allow", "permission_groups": [{}, {}], - "resources": {}, + "resources": { + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }, } ], ) @@ -106,7 +112,10 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: { "effect": "allow", "permission_groups": [{}, {}], - "resources": {}, + "resources": { + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }, } ], ) as response: @@ -158,8 +167,8 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: }, ], "resources": { - "resource": "resource", - "scope": "scope", + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", }, } ], @@ -364,7 +373,10 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: { "effect": "allow", "permission_groups": [{}, {}], - "resources": {}, + "resources": { + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }, } ], ) @@ -393,8 +405,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare }, ], "resources": { - "resource": "resource", - "scope": "scope", + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", }, } ], @@ -418,7 +430,10 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: { "effect": "allow", "permission_groups": [{}, {}], - "resources": {}, + "resources": { + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }, } ], ) @@ -437,7 +452,10 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> { "effect": "allow", "permission_groups": [{}, {}], - "resources": {}, + "resources": { + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }, } ], ) as response: @@ -489,8 +507,8 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare }, ], "resources": { - "resource": "resource", - "scope": "scope", + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", }, } ], diff --git a/tests/api_resources/vectorize/test_indexes.py b/tests/api_resources/vectorize/test_indexes.py index 97fe5c1b9e8..272871b4418 100644 --- a/tests/api_resources/vectorize/test_indexes.py +++ b/tests/api_resources/vectorize/test_indexes.py @@ -141,7 +141,7 @@ def test_method_delete(self, client: Cloudflare) -> None: index_name="example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IndexDeleteResponse, index, path=["response"]) + assert_matches_type(Optional[IndexDeleteResponse], index, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -153,7 +153,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(IndexDeleteResponse, index, path=["response"]) + assert_matches_type(Optional[IndexDeleteResponse], index, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -165,7 +165,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(IndexDeleteResponse, index, path=["response"]) + assert_matches_type(Optional[IndexDeleteResponse], index, path=["response"]) assert cast(Any, response.is_closed) is True @@ -717,7 +717,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: index_name="example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IndexDeleteResponse, index, path=["response"]) + assert_matches_type(Optional[IndexDeleteResponse], index, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -729,7 +729,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(IndexDeleteResponse, index, path=["response"]) + assert_matches_type(Optional[IndexDeleteResponse], index, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -741,7 +741,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(IndexDeleteResponse, index, path=["response"]) + assert_matches_type(Optional[IndexDeleteResponse], index, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/scripts/test_content.py b/tests/api_resources/workers/scripts/test_content.py index 24a9e4d4cf5..9f7629d9227 100644 --- a/tests/api_resources/workers/scripts/test_content.py +++ b/tests/api_resources/workers/scripts/test_content.py @@ -31,6 +31,7 @@ def test_method_update(self, client: Cloudflare) -> None: content = client.workers.scripts.content.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert_matches_type(Optional[Script], content, path=["response"]) @@ -40,7 +41,6 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: content = client.workers.scripts.content.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", - any_part_name=[b"raw file contents"], metadata={ "body_part": "worker.js", "main_module": "worker.js", @@ -56,6 +56,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: response = client.workers.scripts.content.with_raw_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert response.is_closed is True @@ -69,6 +70,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: with client.workers.scripts.content.with_streaming_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -85,12 +87,14 @@ def test_path_params_update(self, client: Cloudflare) -> None: client.workers.scripts.content.with_raw_response.update( script_name="this-is_my_script-01", account_id="", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): client.workers.scripts.content.with_raw_response.update( script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) @parametrize @@ -169,6 +173,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: content = await async_client.workers.scripts.content.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert_matches_type(Optional[Script], content, path=["response"]) @@ -178,7 +183,6 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare content = await async_client.workers.scripts.content.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", - any_part_name=[b"raw file contents"], metadata={ "body_part": "worker.js", "main_module": "worker.js", @@ -194,6 +198,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.scripts.content.with_raw_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert response.is_closed is True @@ -207,6 +212,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> async with async_client.workers.scripts.content.with_streaming_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -223,12 +229,14 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: await async_client.workers.scripts.content.with_raw_response.update( script_name="this-is_my_script-01", account_id="", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): await async_client.workers.scripts.content.with_raw_response.update( script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) @parametrize diff --git a/tests/api_resources/workers/scripts/test_versions.py b/tests/api_resources/workers/scripts/test_versions.py index 1525f49c746..5fbc0e71d33 100644 --- a/tests/api_resources/workers/scripts/test_versions.py +++ b/tests/api_resources/workers/scripts/test_versions.py @@ -28,6 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: version = client.workers.scripts.versions.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={"main_module": "worker.js"}, ) assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) @@ -37,8 +38,8 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: version = client.workers.scripts.versions.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", - any_part_name=[b"raw file contents"], metadata={ + "main_module": "worker.js", "annotations": { "workers_message": "Fixed worker code.", "workers_tag": "workers/tag", @@ -46,14 +47,12 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: "bindings": [ { "name": "MY_ENV_VAR", - "text": "my_data", "type": "plain_text", } ], - "compatibility_date": "2023-07-25", - "compatibility_flags": ["string"], + "compatibility_date": "2021-01-01", + "compatibility_flags": ["nodejs_compat"], "keep_bindings": ["string"], - "main_module": "worker.js", "usage_model": "standard", }, ) @@ -65,6 +64,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: response = client.workers.scripts.versions.with_raw_response.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={"main_module": "worker.js"}, ) assert response.is_closed is True @@ -78,6 +78,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: with client.workers.scripts.versions.with_streaming_response.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={"main_module": "worker.js"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -94,12 +95,14 @@ def test_path_params_create(self, client: Cloudflare) -> None: client.workers.scripts.versions.with_raw_response.create( script_name="this-is_my_script-01", account_id="", + metadata={"main_module": "worker.js"}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): client.workers.scripts.versions.with_raw_response.create( script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={"main_module": "worker.js"}, ) @parametrize @@ -231,6 +234,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: version = await async_client.workers.scripts.versions.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={"main_module": "worker.js"}, ) assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) @@ -240,8 +244,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare version = await async_client.workers.scripts.versions.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", - any_part_name=[b"raw file contents"], metadata={ + "main_module": "worker.js", "annotations": { "workers_message": "Fixed worker code.", "workers_tag": "workers/tag", @@ -249,14 +253,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare "bindings": [ { "name": "MY_ENV_VAR", - "text": "my_data", "type": "plain_text", } ], - "compatibility_date": "2023-07-25", - "compatibility_flags": ["string"], + "compatibility_date": "2021-01-01", + "compatibility_flags": ["nodejs_compat"], "keep_bindings": ["string"], - "main_module": "worker.js", "usage_model": "standard", }, ) @@ -268,6 +270,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.scripts.versions.with_raw_response.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={"main_module": "worker.js"}, ) assert response.is_closed is True @@ -281,6 +284,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> async with async_client.workers.scripts.versions.with_streaming_response.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={"main_module": "worker.js"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -297,12 +301,14 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: await async_client.workers.scripts.versions.with_raw_response.create( script_name="this-is_my_script-01", account_id="", + metadata={"main_module": "worker.js"}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): await async_client.workers.scripts.versions.with_raw_response.create( script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={"main_module": "worker.js"}, ) @parametrize diff --git a/tests/api_resources/workers/test_routes.py b/tests/api_resources/workers/test_routes.py new file mode 100644 index 00000000000..86895a348ba --- /dev/null +++ b/tests/api_resources/workers/test_routes.py @@ -0,0 +1,525 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, Optional, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.workers import ( + RouteGetResponse, + RouteListResponse, + RouteCreateResponse, + RouteDeleteResponse, + RouteUpdateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRoutes: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + route = client.workers.routes.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + assert_matches_type(RouteCreateResponse, route, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + route = client.workers.routes.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + script="this-is_my_script-01", + ) + assert_matches_type(RouteCreateResponse, route, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.workers.routes.with_raw_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = response.parse() + assert_matches_type(RouteCreateResponse, route, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.workers.routes.with_streaming_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = response.parse() + assert_matches_type(RouteCreateResponse, route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.workers.routes.with_raw_response.create( + zone_id="", + pattern="example.net/*", + ) + + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + route = client.workers.routes.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + assert_matches_type(Optional[RouteUpdateResponse], route, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Cloudflare) -> None: + route = client.workers.routes.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + script="this-is_my_script-01", + ) + assert_matches_type(Optional[RouteUpdateResponse], route, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Cloudflare) -> None: + response = client.workers.routes.with_raw_response.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = response.parse() + assert_matches_type(Optional[RouteUpdateResponse], route, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with client.workers.routes.with_streaming_response.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = response.parse() + assert_matches_type(Optional[RouteUpdateResponse], route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.workers.routes.with_raw_response.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + pattern="example.net/*", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): + client.workers.routes.with_raw_response.update( + route_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + route = client.workers.routes.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[RouteListResponse], route, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.workers.routes.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = response.parse() + assert_matches_type(SyncSinglePage[RouteListResponse], route, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.workers.routes.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = response.parse() + assert_matches_type(SyncSinglePage[RouteListResponse], route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.workers.routes.with_raw_response.list( + zone_id="", + ) + + @parametrize + def test_method_delete(self, client: Cloudflare) -> None: + route = client.workers.routes.delete( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(RouteDeleteResponse, route, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Cloudflare) -> None: + response = client.workers.routes.with_raw_response.delete( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = response.parse() + assert_matches_type(RouteDeleteResponse, route, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Cloudflare) -> None: + with client.workers.routes.with_streaming_response.delete( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = response.parse() + assert_matches_type(RouteDeleteResponse, route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.workers.routes.with_raw_response.delete( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): + client.workers.routes.with_raw_response.delete( + route_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + route = client.workers.routes.get( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[RouteGetResponse], route, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.workers.routes.with_raw_response.get( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = response.parse() + assert_matches_type(Optional[RouteGetResponse], route, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.workers.routes.with_streaming_response.get( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = response.parse() + assert_matches_type(Optional[RouteGetResponse], route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.workers.routes.with_raw_response.get( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): + client.workers.routes.with_raw_response.get( + route_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + +class TestAsyncRoutes: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + route = await async_client.workers.routes.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + assert_matches_type(RouteCreateResponse, route, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + route = await async_client.workers.routes.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + script="this-is_my_script-01", + ) + assert_matches_type(RouteCreateResponse, route, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers.routes.with_raw_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = await response.parse() + assert_matches_type(RouteCreateResponse, route, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers.routes.with_streaming_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = await response.parse() + assert_matches_type(RouteCreateResponse, route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.workers.routes.with_raw_response.create( + zone_id="", + pattern="example.net/*", + ) + + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + route = await async_client.workers.routes.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + assert_matches_type(Optional[RouteUpdateResponse], route, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: + route = await async_client.workers.routes.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + script="this-is_my_script-01", + ) + assert_matches_type(Optional[RouteUpdateResponse], route, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers.routes.with_raw_response.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = await response.parse() + assert_matches_type(Optional[RouteUpdateResponse], route, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers.routes.with_streaming_response.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = await response.parse() + assert_matches_type(Optional[RouteUpdateResponse], route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.workers.routes.with_raw_response.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + pattern="example.net/*", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): + await async_client.workers.routes.with_raw_response.update( + route_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + route = await async_client.workers.routes.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[RouteListResponse], route, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers.routes.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = await response.parse() + assert_matches_type(AsyncSinglePage[RouteListResponse], route, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers.routes.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = await response.parse() + assert_matches_type(AsyncSinglePage[RouteListResponse], route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.workers.routes.with_raw_response.list( + zone_id="", + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncCloudflare) -> None: + route = await async_client.workers.routes.delete( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(RouteDeleteResponse, route, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers.routes.with_raw_response.delete( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = await response.parse() + assert_matches_type(RouteDeleteResponse, route, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers.routes.with_streaming_response.delete( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = await response.parse() + assert_matches_type(RouteDeleteResponse, route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.workers.routes.with_raw_response.delete( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): + await async_client.workers.routes.with_raw_response.delete( + route_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + route = await async_client.workers.routes.get( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[RouteGetResponse], route, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers.routes.with_raw_response.get( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = await response.parse() + assert_matches_type(Optional[RouteGetResponse], route, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers.routes.with_streaming_response.get( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = await response.parse() + assert_matches_type(Optional[RouteGetResponse], route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.workers.routes.with_raw_response.get( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): + await async_client.workers.routes.with_raw_response.get( + route_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/workers/test_scripts.py b/tests/api_resources/workers/test_scripts.py index f031908950b..342dd8c9531 100644 --- a/tests/api_resources/workers/test_scripts.py +++ b/tests/api_resources/workers/test_scripts.py @@ -5,20 +5,15 @@ import os from typing import Any, Optional, cast -import httpx import pytest -from respx import MockRouter from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare._response import ( - BinaryAPIResponse, - AsyncBinaryAPIResponse, - StreamedBinaryAPIResponse, - AsyncStreamedBinaryAPIResponse, -) from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.workers import Script, ScriptUpdateResponse +from cloudflare.types.workers import ( + Script, + ScriptUpdateResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,21 +23,20 @@ class TestScripts: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - def test_method_update_overload_1(self, client: Cloudflare) -> None: + def test_method_update(self, client: Cloudflare) -> None: script = client.workers.scripts.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> None: + def test_method_update_with_all_params(self, client: Cloudflare) -> None: script = client.workers.scripts.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", - rollback_to="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - any_part_name=[b"raw file contents"], metadata={ "assets": { "config": { @@ -59,8 +53,8 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N } ], "body_part": "worker.js", - "compatibility_date": "2023-07-25", - "compatibility_flags": ["string"], + "compatibility_date": "2021-01-01", + "compatibility_flags": ["nodejs_compat"], "keep_assets": False, "keep_bindings": ["string"], "logpush": False, @@ -98,18 +92,18 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N "namespace": "my-namespace", } ], - "usage_model": "bundled", - "version_tags": {"foo": "string"}, + "usage_model": "standard", }, ) assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - def test_raw_response_update_overload_1(self, client: Cloudflare) -> None: + def test_raw_response_update(self, client: Cloudflare) -> None: response = client.workers.scripts.with_raw_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert response.is_closed is True @@ -119,10 +113,11 @@ def test_raw_response_update_overload_1(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: + def test_streaming_response_update(self, client: Cloudflare) -> None: with client.workers.scripts.with_streaming_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -134,80 +129,19 @@ def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - def test_path_params_update_overload_1(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.scripts.with_raw_response.update( - script_name="this-is_my_script-01", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - client.workers.scripts.with_raw_response.update( - script_name="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_overload_2(self, client: Cloudflare) -> None: - script = client.workers.scripts.update( - script_name="this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> None: - script = client.workers.scripts.update( - script_name="this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - rollback_to="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - message="message", - ) - assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update_overload_2(self, client: Cloudflare) -> None: - response = client.workers.scripts.with_raw_response.update( - script_name="this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - script = response.parse() - assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update_overload_2(self, client: Cloudflare) -> None: - with client.workers.scripts.with_streaming_response.update( - script_name="this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - script = response.parse() - assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update_overload_2(self, client: Cloudflare) -> None: + 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.workers.scripts.with_raw_response.update( script_name="this-is_my_script-01", account_id="", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): client.workers.scripts.with_raw_response.update( script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) @parametrize @@ -306,58 +240,40 @@ def test_path_params_delete(self, client: Cloudflare) -> None: ) @parametrize - @pytest.mark.respx(base_url=base_url) - def test_method_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/scripts/this-is_my_script-01").mock( - return_value=httpx.Response(200, json={"foo": "bar"}) - ) + def test_method_get(self, client: Cloudflare) -> None: script = client.workers.scripts.get( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert script.is_closed - assert script.json() == {"foo": "bar"} - assert cast(Any, script.is_closed) is True - assert isinstance(script, BinaryAPIResponse) + assert_matches_type(str, script, path=["response"]) @parametrize - @pytest.mark.respx(base_url=base_url) - def test_raw_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/scripts/this-is_my_script-01").mock( - return_value=httpx.Response(200, json={"foo": "bar"}) - ) - - script = client.workers.scripts.with_raw_response.get( + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.workers.scripts.with_raw_response.get( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert script.is_closed is True - assert script.http_request.headers.get("X-Stainless-Lang") == "python" - assert script.json() == {"foo": "bar"} - assert isinstance(script, BinaryAPIResponse) + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + script = response.parse() + assert_matches_type(str, script, path=["response"]) @parametrize - @pytest.mark.respx(base_url=base_url) - def test_streaming_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/scripts/this-is_my_script-01").mock( - return_value=httpx.Response(200, json={"foo": "bar"}) - ) + def test_streaming_response_get(self, client: Cloudflare) -> None: with client.workers.scripts.with_streaming_response.get( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as script: - assert not script.is_closed - assert script.http_request.headers.get("X-Stainless-Lang") == "python" + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - assert script.json() == {"foo": "bar"} - assert cast(Any, script.is_closed) is True - assert isinstance(script, StreamedBinaryAPIResponse) + script = response.parse() + assert_matches_type(str, script, path=["response"]) - assert cast(Any, script.is_closed) is True + assert cast(Any, response.is_closed) is True @parametrize - @pytest.mark.respx(base_url=base_url) 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.scripts.with_raw_response.get( @@ -377,21 +293,20 @@ class TestAsyncScripts: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_method_update(self, async_client: AsyncCloudflare) -> None: script = await async_client.workers.scripts.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_with_all_params_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: script = await async_client.workers.scripts.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", - rollback_to="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - any_part_name=[b"raw file contents"], metadata={ "assets": { "config": { @@ -408,8 +323,8 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn } ], "body_part": "worker.js", - "compatibility_date": "2023-07-25", - "compatibility_flags": ["string"], + "compatibility_date": "2021-01-01", + "compatibility_flags": ["nodejs_compat"], "keep_assets": False, "keep_bindings": ["string"], "logpush": False, @@ -447,18 +362,18 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn "namespace": "my-namespace", } ], - "usage_model": "bundled", - "version_tags": {"foo": "string"}, + "usage_model": "standard", }, ) assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_update_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.scripts.with_raw_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert response.is_closed is True @@ -468,10 +383,11 @@ async def test_raw_response_update_overload_1(self, async_client: AsyncCloudflar @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_update_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.workers.scripts.with_streaming_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -483,80 +399,19 @@ async def test_streaming_response_update_overload_1(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_update_overload_1(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.scripts.with_raw_response.update( - script_name="this-is_my_script-01", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - await async_client.workers.scripts.with_raw_response.update( - script_name="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> None: - script = await async_client.workers.scripts.update( - script_name="this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_update_with_all_params_overload_2(self, async_client: AsyncCloudflare) -> None: - script = await async_client.workers.scripts.update( - script_name="this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - rollback_to="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - message="message", - ) - assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_update_overload_2(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.scripts.with_raw_response.update( - script_name="this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - script = await response.parse() - assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_update_overload_2(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.scripts.with_streaming_response.update( - script_name="this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - script = await response.parse() - assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_update_overload_2(self, async_client: AsyncCloudflare) -> None: + 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.workers.scripts.with_raw_response.update( script_name="this-is_my_script-01", account_id="", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): await async_client.workers.scripts.with_raw_response.update( script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) @parametrize @@ -655,58 +510,40 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: ) @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_method_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/scripts/this-is_my_script-01").mock( - return_value=httpx.Response(200, json={"foo": "bar"}) - ) + async def test_method_get(self, async_client: AsyncCloudflare) -> None: script = await async_client.workers.scripts.get( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert script.is_closed - assert await script.json() == {"foo": "bar"} - assert cast(Any, script.is_closed) is True - assert isinstance(script, AsyncBinaryAPIResponse) + assert_matches_type(str, script, path=["response"]) @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_raw_response_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/scripts/this-is_my_script-01").mock( - return_value=httpx.Response(200, json={"foo": "bar"}) - ) - - script = await async_client.workers.scripts.with_raw_response.get( + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers.scripts.with_raw_response.get( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert script.is_closed is True - assert script.http_request.headers.get("X-Stainless-Lang") == "python" - assert await script.json() == {"foo": "bar"} - assert isinstance(script, AsyncBinaryAPIResponse) + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + script = await response.parse() + assert_matches_type(str, script, path=["response"]) @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_streaming_response_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/scripts/this-is_my_script-01").mock( - return_value=httpx.Response(200, json={"foo": "bar"}) - ) + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.workers.scripts.with_streaming_response.get( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as script: - assert not script.is_closed - assert script.http_request.headers.get("X-Stainless-Lang") == "python" + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - assert await script.json() == {"foo": "bar"} - assert cast(Any, script.is_closed) is True - assert isinstance(script, AsyncStreamedBinaryAPIResponse) + script = await response.parse() + assert_matches_type(str, script, path=["response"]) - assert cast(Any, script.is_closed) is True + assert cast(Any, response.is_closed) is True @parametrize - @pytest.mark.respx(base_url=base_url) 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.scripts.with_raw_response.get( diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_asset_upload.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_asset_upload.py new file mode 100644 index 00000000000..e709c6dc236 --- /dev/null +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_asset_upload.py @@ -0,0 +1,176 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, Optional, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import ( + AssetUploadCreateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAssetUpload: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + asset_upload = client.workers_for_platforms.dispatch.namespaces.scripts.asset_upload.create( + script_name="this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) + assert_matches_type(Optional[AssetUploadCreateResponse], asset_upload, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + asset_upload = client.workers_for_platforms.dispatch.namespaces.scripts.asset_upload.create( + script_name="this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + manifest={ + "foo": { + "hash": "hash", + "size": 0, + } + }, + ) + assert_matches_type(Optional[AssetUploadCreateResponse], asset_upload, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.workers_for_platforms.dispatch.namespaces.scripts.asset_upload.with_raw_response.create( + script_name="this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + asset_upload = response.parse() + assert_matches_type(Optional[AssetUploadCreateResponse], asset_upload, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.workers_for_platforms.dispatch.namespaces.scripts.asset_upload.with_streaming_response.create( + script_name="this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + asset_upload = response.parse() + assert_matches_type(Optional[AssetUploadCreateResponse], asset_upload, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.workers_for_platforms.dispatch.namespaces.scripts.asset_upload.with_raw_response.create( + script_name="this-is_my_script-01", + account_id="", + dispatch_namespace="my-dispatch-namespace", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): + client.workers_for_platforms.dispatch.namespaces.scripts.asset_upload.with_raw_response.create( + script_name="this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): + client.workers_for_platforms.dispatch.namespaces.scripts.asset_upload.with_raw_response.create( + script_name="", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) + + +class TestAsyncAssetUpload: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + asset_upload = await async_client.workers_for_platforms.dispatch.namespaces.scripts.asset_upload.create( + script_name="this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) + assert_matches_type(Optional[AssetUploadCreateResponse], asset_upload, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + asset_upload = await async_client.workers_for_platforms.dispatch.namespaces.scripts.asset_upload.create( + script_name="this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + manifest={ + "foo": { + "hash": "hash", + "size": 0, + } + }, + ) + assert_matches_type(Optional[AssetUploadCreateResponse], asset_upload, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = ( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.asset_upload.with_raw_response.create( + script_name="this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + asset_upload = await response.parse() + assert_matches_type(Optional[AssetUploadCreateResponse], asset_upload, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers_for_platforms.dispatch.namespaces.scripts.asset_upload.with_streaming_response.create( + script_name="this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + asset_upload = await response.parse() + assert_matches_type(Optional[AssetUploadCreateResponse], asset_upload, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.workers_for_platforms.dispatch.namespaces.scripts.asset_upload.with_raw_response.create( + script_name="this-is_my_script-01", + account_id="", + dispatch_namespace="my-dispatch-namespace", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): + await async_client.workers_for_platforms.dispatch.namespaces.scripts.asset_upload.with_raw_response.create( + script_name="this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): + await async_client.workers_for_platforms.dispatch.namespaces.scripts.asset_upload.with_raw_response.create( + script_name="", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_content.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_content.py index b869d42a76e..822e7f80d7a 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_content.py +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_content.py @@ -32,6 +32,7 @@ def test_method_update(self, client: Cloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) assert_matches_type(Optional[Script], content, path=["response"]) @@ -42,7 +43,6 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - any_part_name=[b"raw file contents"], metadata={ "body_part": "worker.js", "main_module": "worker.js", @@ -59,6 +59,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) assert response.is_closed is True @@ -73,6 +74,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -90,6 +92,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: script_name="this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): @@ -97,6 +100,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): @@ -104,6 +108,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) @parametrize @@ -195,6 +200,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) assert_matches_type(Optional[Script], content, path=["response"]) @@ -205,7 +211,6 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - any_part_name=[b"raw file contents"], metadata={ "body_part": "worker.js", "main_module": "worker.js", @@ -223,6 +228,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) ) @@ -238,6 +244,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -255,6 +262,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: script_name="this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): @@ -262,6 +270,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): @@ -269,6 +278,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) @parametrize diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_settings.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_settings.py index 50a6f309b63..b3a2e96a5d1 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_settings.py +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_settings.py @@ -38,9 +38,14 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", settings={ - "bindings": [{"type": "kv_namespace"}], - "compatibility_date": "2022-04-05", - "compatibility_flags": ["formdata_parser_supports_files"], + "bindings": [ + { + "name": "MY_ENV_VAR", + "type": "plain_text", + } + ], + "compatibility_date": "2021-01-01", + "compatibility_flags": ["nodejs_compat"], "limits": {"cpu_ms": 50}, "logpush": False, "migrations": { @@ -76,7 +81,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "namespace": "my-namespace", } ], - "usage_model": "unbound", + "usage_model": "standard", }, ) assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) @@ -217,9 +222,14 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", settings={ - "bindings": [{"type": "kv_namespace"}], - "compatibility_date": "2022-04-05", - "compatibility_flags": ["formdata_parser_supports_files"], + "bindings": [ + { + "name": "MY_ENV_VAR", + "type": "plain_text", + } + ], + "compatibility_date": "2021-01-01", + "compatibility_flags": ["nodejs_compat"], "limits": {"cpu_ms": 50}, "logpush": False, "migrations": { @@ -255,7 +265,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "namespace": "my-namespace", } ], - "usage_model": "unbound", + "usage_model": "standard", }, ) assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/test_scripts.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/test_scripts.py index c5c287cfdab..cfec51aadc0 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/namespaces/test_scripts.py +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/test_scripts.py @@ -22,22 +22,22 @@ class TestScripts: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - def test_method_update_overload_1(self, client: Cloudflare) -> None: + def test_method_update(self, client: Cloudflare) -> None: script = client.workers_for_platforms.dispatch.namespaces.scripts.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> None: + def test_method_update_with_all_params(self, client: Cloudflare) -> None: script = client.workers_for_platforms.dispatch.namespaces.scripts.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - any_part_name=[b"raw file contents"], metadata={ "assets": { "config": { @@ -54,8 +54,8 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N } ], "body_part": "worker.js", - "compatibility_date": "2023-07-25", - "compatibility_flags": ["string"], + "compatibility_date": "2021-01-01", + "compatibility_flags": ["nodejs_compat"], "keep_assets": False, "keep_bindings": ["string"], "logpush": False, @@ -93,19 +93,19 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N "namespace": "my-namespace", } ], - "usage_model": "bundled", - "version_tags": {"foo": "string"}, + "usage_model": "standard", }, ) assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - def test_raw_response_update_overload_1(self, client: Cloudflare) -> None: + def test_raw_response_update(self, client: Cloudflare) -> None: response = client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) assert response.is_closed is True @@ -115,11 +115,12 @@ def test_raw_response_update_overload_1(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: + def test_streaming_response_update(self, client: Cloudflare) -> None: with client.workers_for_platforms.dispatch.namespaces.scripts.with_streaming_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -131,87 +132,13 @@ def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - def test_path_params_update_overload_1(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.scripts.with_raw_response.update( - script_name="this-is_my_script-01", - account_id="", - dispatch_namespace="my-dispatch-namespace", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): - client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.update( - script_name="this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.update( - script_name="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="my-dispatch-namespace", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_overload_2(self, client: Cloudflare) -> None: - script = client.workers_for_platforms.dispatch.namespaces.scripts.update( - script_name="this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="my-dispatch-namespace", - ) - assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> None: - script = client.workers_for_platforms.dispatch.namespaces.scripts.update( - script_name="this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="my-dispatch-namespace", - message="message", - ) - assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update_overload_2(self, client: Cloudflare) -> None: - response = client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.update( - script_name="this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="my-dispatch-namespace", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - script = response.parse() - assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update_overload_2(self, client: Cloudflare) -> None: - with client.workers_for_platforms.dispatch.namespaces.scripts.with_streaming_response.update( - script_name="this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="my-dispatch-namespace", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - script = response.parse() - assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update_overload_2(self, client: Cloudflare) -> None: + 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.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.update( script_name="this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): @@ -219,6 +146,7 @@ def test_path_params_update_overload_2(self, client: Cloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): @@ -226,6 +154,7 @@ def test_path_params_update_overload_2(self, client: Cloudflare) -> None: script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) @parametrize @@ -364,22 +293,22 @@ class TestAsyncScripts: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_method_update(self, async_client: AsyncCloudflare) -> None: script = await async_client.workers_for_platforms.dispatch.namespaces.scripts.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update_with_all_params_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: script = await async_client.workers_for_platforms.dispatch.namespaces.scripts.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - any_part_name=[b"raw file contents"], metadata={ "assets": { "config": { @@ -396,8 +325,8 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn } ], "body_part": "worker.js", - "compatibility_date": "2023-07-25", - "compatibility_flags": ["string"], + "compatibility_date": "2021-01-01", + "compatibility_flags": ["nodejs_compat"], "keep_assets": False, "keep_bindings": ["string"], "logpush": False, @@ -435,94 +364,19 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn "namespace": "my-namespace", } ], - "usage_model": "bundled", - "version_tags": {"foo": "string"}, + "usage_model": "standard", }, ) assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_update_overload_1(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.update( - script_name="this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="my-dispatch-namespace", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - script = await response.parse() - assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_update_overload_1(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers_for_platforms.dispatch.namespaces.scripts.with_streaming_response.update( - script_name="this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="my-dispatch-namespace", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - script = await response.parse() - assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_update_overload_1(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.scripts.with_raw_response.update( - script_name="this-is_my_script-01", - account_id="", - dispatch_namespace="my-dispatch-namespace", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): - await async_client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.update( - script_name="this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - await async_client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.update( - script_name="", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="my-dispatch-namespace", - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> None: - script = await async_client.workers_for_platforms.dispatch.namespaces.scripts.update( - script_name="this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="my-dispatch-namespace", - ) - assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_update_with_all_params_overload_2(self, async_client: AsyncCloudflare) -> None: - script = await async_client.workers_for_platforms.dispatch.namespaces.scripts.update( - script_name="this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="my-dispatch-namespace", - message="message", - ) - assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_update_overload_2(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) assert response.is_closed is True @@ -532,11 +386,12 @@ async def test_raw_response_update_overload_2(self, async_client: AsyncCloudflar @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_update_overload_2(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.workers_for_platforms.dispatch.namespaces.scripts.with_streaming_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -548,12 +403,13 @@ async def test_streaming_response_update_overload_2(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_update_overload_2(self, async_client: AsyncCloudflare) -> None: + 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.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.update( script_name="this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): @@ -561,6 +417,7 @@ async def test_path_params_update_overload_2(self, async_client: AsyncCloudflare script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): @@ -568,6 +425,7 @@ async def test_path_params_update_overload_2(self, async_client: AsyncCloudflare script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) @parametrize diff --git a/tests/api_resources/zero_trust/access/infrastructure/test_targets.py b/tests/api_resources/zero_trust/access/infrastructure/test_targets.py index 6d6fec64674..263003e2c00 100644 --- a/tests/api_resources/zero_trust/access/infrastructure/test_targets.py +++ b/tests/api_resources/zero_trust/access/infrastructure/test_targets.py @@ -178,11 +178,16 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: target = client.zero_trust.access.infrastructure.targets.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", created_after=parse_datetime("2019-12-27T18:11:19.117Z"), + created_before=parse_datetime("2019-12-27T18:11:19.117Z"), + direction="asc", hostname="hostname", hostname_contains="hostname_contains", ip_v4="ip_v4", ip_v6="ip_v6", + ips=["string"], modified_after=parse_datetime("2019-12-27T18:11:19.117Z"), + modified_before=parse_datetime("2019-12-27T18:11:19.117Z"), + order="hostname", page=1, per_page=1, virtual_network_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -573,11 +578,16 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) target = await async_client.zero_trust.access.infrastructure.targets.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", created_after=parse_datetime("2019-12-27T18:11:19.117Z"), + created_before=parse_datetime("2019-12-27T18:11:19.117Z"), + direction="asc", hostname="hostname", hostname_contains="hostname_contains", ip_v4="ip_v4", ip_v6="ip_v6", + ips=["string"], modified_after=parse_datetime("2019-12-27T18:11:19.117Z"), + modified_before=parse_datetime("2019-12-27T18:11:19.117Z"), + order="hostname", page=1, per_page=1, virtual_network_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", diff --git a/tests/api_resources/zero_trust/access/test_applications.py b/tests/api_resources/zero_trust/access/test_applications.py index 17ca2921b84..3b041b0653f 100644 --- a/tests/api_resources/zero_trust/access/test_applications.py +++ b/tests/api_resources/zero_trust/access/test_applications.py @@ -69,16 +69,28 @@ def test_method_create_with_all_params_overload_1(self, client: Cloudflare) -> N "uri": "test.anotherexample.com/staff", }, { - "type": "public", - "uri": "10.5.0.2", + "cidr": "10.5.0.0/24", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80-90", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "10.5.0.3/32:1234-4321", + "cidr": "10.5.0.3/32", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "private-sni.example.com", + "cidr": "cidr", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "port_range", + "type": "private", + "vnet_id": "vnet_id", }, ], enable_binding_cookie=True, @@ -340,16 +352,28 @@ def test_method_create_with_all_params_overload_3(self, client: Cloudflare) -> N "uri": "test.anotherexample.com/staff", }, { - "type": "public", - "uri": "10.5.0.2", + "cidr": "10.5.0.0/24", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80-90", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "10.5.0.3/32:1234-4321", + "cidr": "10.5.0.3/32", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "private-sni.example.com", + "cidr": "cidr", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "port_range", + "type": "private", + "vnet_id": "vnet_id", }, ], enable_binding_cookie=True, @@ -490,16 +514,28 @@ def test_method_create_with_all_params_overload_4(self, client: Cloudflare) -> N "uri": "test.anotherexample.com/staff", }, { - "type": "public", - "uri": "10.5.0.2", + "cidr": "10.5.0.0/24", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80-90", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "10.5.0.3/32:1234-4321", + "cidr": "10.5.0.3/32", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "private-sni.example.com", + "cidr": "cidr", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "port_range", + "type": "private", + "vnet_id": "vnet_id", }, ], enable_binding_cookie=True, @@ -1183,16 +1219,28 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N "uri": "test.anotherexample.com/staff", }, { - "type": "public", - "uri": "10.5.0.2", + "cidr": "10.5.0.0/24", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80-90", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "10.5.0.3/32:1234-4321", + "cidr": "10.5.0.3/32", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "private-sni.example.com", + "cidr": "cidr", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "port_range", + "type": "private", + "vnet_id": "vnet_id", }, ], enable_binding_cookie=True, @@ -1480,16 +1528,28 @@ def test_method_update_with_all_params_overload_3(self, client: Cloudflare) -> N "uri": "test.anotherexample.com/staff", }, { - "type": "public", - "uri": "10.5.0.2", + "cidr": "10.5.0.0/24", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80-90", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "10.5.0.3/32:1234-4321", + "cidr": "10.5.0.3/32", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "private-sni.example.com", + "cidr": "cidr", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "port_range", + "type": "private", + "vnet_id": "vnet_id", }, ], enable_binding_cookie=True, @@ -1644,16 +1704,28 @@ def test_method_update_with_all_params_overload_4(self, client: Cloudflare) -> N "uri": "test.anotherexample.com/staff", }, { - "type": "public", - "uri": "10.5.0.2", + "cidr": "10.5.0.0/24", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80-90", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "10.5.0.3/32:1234-4321", + "cidr": "10.5.0.3/32", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "private-sni.example.com", + "cidr": "cidr", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "port_range", + "type": "private", + "vnet_id": "vnet_id", }, ], enable_binding_cookie=True, @@ -2682,16 +2754,28 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn "uri": "test.anotherexample.com/staff", }, { - "type": "public", - "uri": "10.5.0.2", + "cidr": "10.5.0.0/24", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80-90", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "10.5.0.3/32:1234-4321", + "cidr": "10.5.0.3/32", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "private-sni.example.com", + "cidr": "cidr", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "port_range", + "type": "private", + "vnet_id": "vnet_id", }, ], enable_binding_cookie=True, @@ -2953,16 +3037,28 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn "uri": "test.anotherexample.com/staff", }, { - "type": "public", - "uri": "10.5.0.2", + "cidr": "10.5.0.0/24", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80-90", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "10.5.0.3/32:1234-4321", + "cidr": "10.5.0.3/32", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "private-sni.example.com", + "cidr": "cidr", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "port_range", + "type": "private", + "vnet_id": "vnet_id", }, ], enable_binding_cookie=True, @@ -3103,16 +3199,28 @@ async def test_method_create_with_all_params_overload_4(self, async_client: Asyn "uri": "test.anotherexample.com/staff", }, { - "type": "public", - "uri": "10.5.0.2", + "cidr": "10.5.0.0/24", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80-90", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "10.5.0.3/32:1234-4321", + "cidr": "10.5.0.3/32", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "private-sni.example.com", + "cidr": "cidr", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "port_range", + "type": "private", + "vnet_id": "vnet_id", }, ], enable_binding_cookie=True, @@ -3796,16 +3904,28 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn "uri": "test.anotherexample.com/staff", }, { - "type": "public", - "uri": "10.5.0.2", + "cidr": "10.5.0.0/24", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80-90", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "10.5.0.3/32:1234-4321", + "cidr": "10.5.0.3/32", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "private-sni.example.com", + "cidr": "cidr", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "port_range", + "type": "private", + "vnet_id": "vnet_id", }, ], enable_binding_cookie=True, @@ -4093,16 +4213,28 @@ async def test_method_update_with_all_params_overload_3(self, async_client: Asyn "uri": "test.anotherexample.com/staff", }, { - "type": "public", - "uri": "10.5.0.2", + "cidr": "10.5.0.0/24", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80-90", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "10.5.0.3/32:1234-4321", + "cidr": "10.5.0.3/32", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "private-sni.example.com", + "cidr": "cidr", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "port_range", + "type": "private", + "vnet_id": "vnet_id", }, ], enable_binding_cookie=True, @@ -4257,16 +4389,28 @@ async def test_method_update_with_all_params_overload_4(self, async_client: Asyn "uri": "test.anotherexample.com/staff", }, { - "type": "public", - "uri": "10.5.0.2", + "cidr": "10.5.0.0/24", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80-90", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "10.5.0.3/32:1234-4321", + "cidr": "10.5.0.3/32", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "80", + "type": "private", + "vnet_id": "vnet_id", }, { - "type": "public", - "uri": "private-sni.example.com", + "cidr": "cidr", + "hostname": "hostname", + "l4_protocol": "tcp", + "port_range": "port_range", + "type": "private", + "vnet_id": "vnet_id", }, ], enable_binding_cookie=True, diff --git a/tests/api_resources/zero_trust/access/test_gateway_ca.py b/tests/api_resources/zero_trust/access/test_gateway_ca.py new file mode 100644 index 00000000000..723be698029 --- /dev/null +++ b/tests/api_resources/zero_trust/access/test_gateway_ca.py @@ -0,0 +1,271 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, Optional, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.zero_trust.access import GatewayCAListResponse, GatewayCACreateResponse, GatewayCADeleteResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestGatewayCA: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + gateway_ca = client.zero_trust.access.gateway_ca.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[GatewayCACreateResponse], gateway_ca, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.zero_trust.access.gateway_ca.with_raw_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gateway_ca = response.parse() + assert_matches_type(Optional[GatewayCACreateResponse], gateway_ca, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.zero_trust.access.gateway_ca.with_streaming_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gateway_ca = response.parse() + assert_matches_type(Optional[GatewayCACreateResponse], gateway_ca, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.access.gateway_ca.with_raw_response.create( + account_id="", + ) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + gateway_ca = client.zero_trust.access.gateway_ca.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[GatewayCAListResponse], gateway_ca, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.zero_trust.access.gateway_ca.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gateway_ca = response.parse() + assert_matches_type(SyncSinglePage[GatewayCAListResponse], gateway_ca, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.zero_trust.access.gateway_ca.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gateway_ca = response.parse() + assert_matches_type(SyncSinglePage[GatewayCAListResponse], gateway_ca, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.access.gateway_ca.with_raw_response.list( + account_id="", + ) + + @parametrize + def test_method_delete(self, client: Cloudflare) -> None: + gateway_ca = client.zero_trust.access.gateway_ca.delete( + certificate_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[GatewayCADeleteResponse], gateway_ca, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Cloudflare) -> None: + response = client.zero_trust.access.gateway_ca.with_raw_response.delete( + certificate_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gateway_ca = response.parse() + assert_matches_type(Optional[GatewayCADeleteResponse], gateway_ca, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Cloudflare) -> None: + with client.zero_trust.access.gateway_ca.with_streaming_response.delete( + certificate_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gateway_ca = response.parse() + assert_matches_type(Optional[GatewayCADeleteResponse], gateway_ca, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.access.gateway_ca.with_raw_response.delete( + certificate_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"): + client.zero_trust.access.gateway_ca.with_raw_response.delete( + certificate_id="", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + +class TestAsyncGatewayCA: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + gateway_ca = await async_client.zero_trust.access.gateway_ca.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[GatewayCACreateResponse], gateway_ca, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.access.gateway_ca.with_raw_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gateway_ca = await response.parse() + assert_matches_type(Optional[GatewayCACreateResponse], gateway_ca, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.access.gateway_ca.with_streaming_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gateway_ca = await response.parse() + assert_matches_type(Optional[GatewayCACreateResponse], gateway_ca, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.access.gateway_ca.with_raw_response.create( + account_id="", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + gateway_ca = await async_client.zero_trust.access.gateway_ca.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[GatewayCAListResponse], gateway_ca, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.access.gateway_ca.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gateway_ca = await response.parse() + assert_matches_type(AsyncSinglePage[GatewayCAListResponse], gateway_ca, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.access.gateway_ca.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gateway_ca = await response.parse() + assert_matches_type(AsyncSinglePage[GatewayCAListResponse], gateway_ca, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.access.gateway_ca.with_raw_response.list( + account_id="", + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncCloudflare) -> None: + gateway_ca = await async_client.zero_trust.access.gateway_ca.delete( + certificate_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[GatewayCADeleteResponse], gateway_ca, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.access.gateway_ca.with_raw_response.delete( + certificate_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gateway_ca = await response.parse() + assert_matches_type(Optional[GatewayCADeleteResponse], gateway_ca, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.access.gateway_ca.with_streaming_response.delete( + certificate_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gateway_ca = await response.parse() + assert_matches_type(Optional[GatewayCADeleteResponse], gateway_ca, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.access.gateway_ca.with_raw_response.delete( + certificate_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"): + await async_client.zero_trust.access.gateway_ca.with_raw_response.delete( + certificate_id="", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/zero_trust/devices/policies/default/test_certificates.py b/tests/api_resources/zero_trust/devices/policies/default/test_certificates.py index f616978a857..b94cf6d8191 100644 --- a/tests/api_resources/zero_trust/devices/policies/default/test_certificates.py +++ b/tests/api_resources/zero_trust/devices/policies/default/test_certificates.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -26,7 +26,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="699d98642c564d2e855e9661899b7252", enabled=True, ) - assert_matches_type(CertificateEditResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateEditResponse], certificate, path=["response"]) @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: @@ -38,7 +38,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(CertificateEditResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateEditResponse], certificate, path=["response"]) @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(CertificateEditResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateEditResponse], certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -67,7 +67,7 @@ def test_method_get(self, client: Cloudflare) -> None: certificate = client.zero_trust.devices.policies.default.certificates.get( zone_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(CertificateGetResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateGetResponse], certificate, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -78,7 +78,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(CertificateGetResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateGetResponse], certificate, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -89,7 +89,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(CertificateGetResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateGetResponse], certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -110,7 +110,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="699d98642c564d2e855e9661899b7252", enabled=True, ) - assert_matches_type(CertificateEditResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateEditResponse], certificate, path=["response"]) @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -122,7 +122,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(CertificateEditResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateEditResponse], certificate, path=["response"]) @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -134,7 +134,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(CertificateEditResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateEditResponse], certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -151,7 +151,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: certificate = await async_client.zero_trust.devices.policies.default.certificates.get( zone_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(CertificateGetResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateGetResponse], certificate, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -162,7 +162,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(CertificateGetResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateGetResponse], certificate, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -173,7 +173,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(CertificateGetResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateGetResponse], certificate, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/posture/test_integrations.py b/tests/api_resources/zero_trust/devices/posture/test_integrations.py index 6ad1c0fabd0..35efacf4282 100644 --- a/tests/api_resources/zero_trust/devices/posture/test_integrations.py +++ b/tests/api_resources/zero_trust/devices/posture/test_integrations.py @@ -155,7 +155,7 @@ def test_method_delete(self, client: Cloudflare) -> None: integration_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(IntegrationDeleteResponse, integration, path=["response"]) + assert_matches_type(Optional[IntegrationDeleteResponse], integration, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -167,7 +167,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = response.parse() - assert_matches_type(IntegrationDeleteResponse, integration, path=["response"]) + assert_matches_type(Optional[IntegrationDeleteResponse], integration, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -179,7 +179,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = response.parse() - assert_matches_type(IntegrationDeleteResponse, integration, path=["response"]) + assert_matches_type(Optional[IntegrationDeleteResponse], integration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -448,7 +448,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: integration_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(IntegrationDeleteResponse, integration, path=["response"]) + assert_matches_type(Optional[IntegrationDeleteResponse], integration, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -460,7 +460,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = await response.parse() - assert_matches_type(IntegrationDeleteResponse, integration, path=["response"]) + assert_matches_type(Optional[IntegrationDeleteResponse], integration, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -472,7 +472,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = await response.parse() - assert_matches_type(IntegrationDeleteResponse, integration, path=["response"]) + assert_matches_type(Optional[IntegrationDeleteResponse], integration, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/test_revoke.py b/tests/api_resources/zero_trust/devices/test_revoke.py index abfc42857d4..d093db0d2e7 100644 --- a/tests/api_resources/zero_trust/devices/test_revoke.py +++ b/tests/api_resources/zero_trust/devices/test_revoke.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -23,7 +23,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", body=["f174e90a-fafe-4643-bbbc-4a0ed4fc8415"], ) - assert_matches_type(RevokeCreateResponse, revoke, path=["response"]) + assert_matches_type(Optional[RevokeCreateResponse], revoke, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: @@ -35,7 +35,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" revoke = response.parse() - assert_matches_type(RevokeCreateResponse, revoke, path=["response"]) + assert_matches_type(Optional[RevokeCreateResponse], revoke, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: @@ -47,7 +47,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" revoke = response.parse() - assert_matches_type(RevokeCreateResponse, revoke, path=["response"]) + assert_matches_type(Optional[RevokeCreateResponse], revoke, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", body=["f174e90a-fafe-4643-bbbc-4a0ed4fc8415"], ) - assert_matches_type(RevokeCreateResponse, revoke, path=["response"]) + assert_matches_type(Optional[RevokeCreateResponse], revoke, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @@ -81,7 +81,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" revoke = await response.parse() - assert_matches_type(RevokeCreateResponse, revoke, path=["response"]) + assert_matches_type(Optional[RevokeCreateResponse], revoke, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: @@ -93,7 +93,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" revoke = await response.parse() - assert_matches_type(RevokeCreateResponse, revoke, path=["response"]) + assert_matches_type(Optional[RevokeCreateResponse], revoke, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/test_unrevoke.py b/tests/api_resources/zero_trust/devices/test_unrevoke.py index 1c0bc2acdf5..9196cb931f8 100644 --- a/tests/api_resources/zero_trust/devices/test_unrevoke.py +++ b/tests/api_resources/zero_trust/devices/test_unrevoke.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -23,7 +23,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", body=["f174e90a-fafe-4643-bbbc-4a0ed4fc8415"], ) - assert_matches_type(UnrevokeCreateResponse, unrevoke, path=["response"]) + assert_matches_type(Optional[UnrevokeCreateResponse], unrevoke, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: @@ -35,7 +35,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" unrevoke = response.parse() - assert_matches_type(UnrevokeCreateResponse, unrevoke, path=["response"]) + assert_matches_type(Optional[UnrevokeCreateResponse], unrevoke, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: @@ -47,7 +47,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" unrevoke = response.parse() - assert_matches_type(UnrevokeCreateResponse, unrevoke, path=["response"]) + assert_matches_type(Optional[UnrevokeCreateResponse], unrevoke, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", body=["f174e90a-fafe-4643-bbbc-4a0ed4fc8415"], ) - assert_matches_type(UnrevokeCreateResponse, unrevoke, path=["response"]) + assert_matches_type(Optional[UnrevokeCreateResponse], unrevoke, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @@ -81,7 +81,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" unrevoke = await response.parse() - assert_matches_type(UnrevokeCreateResponse, unrevoke, path=["response"]) + assert_matches_type(Optional[UnrevokeCreateResponse], unrevoke, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: @@ -93,7 +93,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" unrevoke = await response.parse() - assert_matches_type(UnrevokeCreateResponse, unrevoke, path=["response"]) + assert_matches_type(Optional[UnrevokeCreateResponse], unrevoke, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/dex/commands/test_devices.py b/tests/api_resources/zero_trust/dex/commands/test_devices.py new file mode 100644 index 00000000000..be6707c9e2a --- /dev/null +++ b/tests/api_resources/zero_trust/dex/commands/test_devices.py @@ -0,0 +1,135 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, Optional, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.pagination import SyncV4PagePagination, AsyncV4PagePagination +from cloudflare.types.zero_trust.dex.commands import DeviceListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestDevices: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + device = client.zero_trust.dex.commands.devices.list( + account_id="01a7362d577a6c3019a474fd6f485823", + page=1, + per_page=1, + ) + assert_matches_type(SyncV4PagePagination[Optional[DeviceListResponse]], device, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + device = client.zero_trust.dex.commands.devices.list( + account_id="01a7362d577a6c3019a474fd6f485823", + page=1, + per_page=1, + search="search", + ) + assert_matches_type(SyncV4PagePagination[Optional[DeviceListResponse]], device, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.zero_trust.dex.commands.devices.with_raw_response.list( + account_id="01a7362d577a6c3019a474fd6f485823", + page=1, + per_page=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + device = response.parse() + assert_matches_type(SyncV4PagePagination[Optional[DeviceListResponse]], device, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.zero_trust.dex.commands.devices.with_streaming_response.list( + account_id="01a7362d577a6c3019a474fd6f485823", + page=1, + per_page=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + device = response.parse() + assert_matches_type(SyncV4PagePagination[Optional[DeviceListResponse]], device, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.dex.commands.devices.with_raw_response.list( + account_id="", + page=1, + per_page=1, + ) + + +class TestAsyncDevices: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + device = await async_client.zero_trust.dex.commands.devices.list( + account_id="01a7362d577a6c3019a474fd6f485823", + page=1, + per_page=1, + ) + assert_matches_type(AsyncV4PagePagination[Optional[DeviceListResponse]], device, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + device = await async_client.zero_trust.dex.commands.devices.list( + account_id="01a7362d577a6c3019a474fd6f485823", + page=1, + per_page=1, + search="search", + ) + assert_matches_type(AsyncV4PagePagination[Optional[DeviceListResponse]], device, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.dex.commands.devices.with_raw_response.list( + account_id="01a7362d577a6c3019a474fd6f485823", + page=1, + per_page=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + device = await response.parse() + assert_matches_type(AsyncV4PagePagination[Optional[DeviceListResponse]], device, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.dex.commands.devices.with_streaming_response.list( + account_id="01a7362d577a6c3019a474fd6f485823", + page=1, + per_page=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + device = await response.parse() + assert_matches_type(AsyncV4PagePagination[Optional[DeviceListResponse]], device, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.dex.commands.devices.with_raw_response.list( + account_id="", + page=1, + per_page=1, + ) diff --git a/tests/api_resources/zero_trust/dex/commands/test_downloads.py b/tests/api_resources/zero_trust/dex/commands/test_downloads.py index b2a9133f988..66711dbdd5a 100644 --- a/tests/api_resources/zero_trust/dex/commands/test_downloads.py +++ b/tests/api_resources/zero_trust/dex/commands/test_downloads.py @@ -27,7 +27,7 @@ class TestDownloads: @pytest.mark.respx(base_url=base_url) def test_method_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: respx_mock.get( - "/accounts/01a7362d577a6c3019a474fd6f485823/commands/5758fefe-ae7e-4538-a39b-1fef6abcb909/downloads/filename" + "/accounts/01a7362d577a6c3019a474fd6f485823/dex/commands/5758fefe-ae7e-4538-a39b-1fef6abcb909/downloads/filename" ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) download = client.zero_trust.dex.commands.downloads.get( filename="filename", @@ -43,7 +43,7 @@ def test_method_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: @pytest.mark.respx(base_url=base_url) def test_raw_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: respx_mock.get( - "/accounts/01a7362d577a6c3019a474fd6f485823/commands/5758fefe-ae7e-4538-a39b-1fef6abcb909/downloads/filename" + "/accounts/01a7362d577a6c3019a474fd6f485823/dex/commands/5758fefe-ae7e-4538-a39b-1fef6abcb909/downloads/filename" ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) download = client.zero_trust.dex.commands.downloads.with_raw_response.get( @@ -61,7 +61,7 @@ def test_raw_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> N @pytest.mark.respx(base_url=base_url) def test_streaming_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: respx_mock.get( - "/accounts/01a7362d577a6c3019a474fd6f485823/commands/5758fefe-ae7e-4538-a39b-1fef6abcb909/downloads/filename" + "/accounts/01a7362d577a6c3019a474fd6f485823/dex/commands/5758fefe-ae7e-4538-a39b-1fef6abcb909/downloads/filename" ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) with client.zero_trust.dex.commands.downloads.with_streaming_response.get( filename="filename", @@ -109,7 +109,7 @@ class TestAsyncDownloads: @pytest.mark.respx(base_url=base_url) async def test_method_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: respx_mock.get( - "/accounts/01a7362d577a6c3019a474fd6f485823/commands/5758fefe-ae7e-4538-a39b-1fef6abcb909/downloads/filename" + "/accounts/01a7362d577a6c3019a474fd6f485823/dex/commands/5758fefe-ae7e-4538-a39b-1fef6abcb909/downloads/filename" ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) download = await async_client.zero_trust.dex.commands.downloads.get( filename="filename", @@ -125,7 +125,7 @@ async def test_method_get(self, async_client: AsyncCloudflare, respx_mock: MockR @pytest.mark.respx(base_url=base_url) async def test_raw_response_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: respx_mock.get( - "/accounts/01a7362d577a6c3019a474fd6f485823/commands/5758fefe-ae7e-4538-a39b-1fef6abcb909/downloads/filename" + "/accounts/01a7362d577a6c3019a474fd6f485823/dex/commands/5758fefe-ae7e-4538-a39b-1fef6abcb909/downloads/filename" ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) download = await async_client.zero_trust.dex.commands.downloads.with_raw_response.get( @@ -143,7 +143,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare, respx_mock: @pytest.mark.respx(base_url=base_url) async def test_streaming_response_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: respx_mock.get( - "/accounts/01a7362d577a6c3019a474fd6f485823/commands/5758fefe-ae7e-4538-a39b-1fef6abcb909/downloads/filename" + "/accounts/01a7362d577a6c3019a474fd6f485823/dex/commands/5758fefe-ae7e-4538-a39b-1fef6abcb909/downloads/filename" ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) async with async_client.zero_trust.dex.commands.downloads.with_streaming_response.get( filename="filename", diff --git a/tests/api_resources/zero_trust/dex/commands/test_users.py b/tests/api_resources/zero_trust/dex/commands/test_users.py new file mode 100644 index 00000000000..0f8b674a2d6 --- /dev/null +++ b/tests/api_resources/zero_trust/dex/commands/test_users.py @@ -0,0 +1,114 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, Optional, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.types.zero_trust.dex.commands import UserListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestUsers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + user = client.zero_trust.dex.commands.users.list( + account_id="01a7362d577a6c3019a474fd6f485823", + ) + assert_matches_type(Optional[UserListResponse], user, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + user = client.zero_trust.dex.commands.users.list( + account_id="01a7362d577a6c3019a474fd6f485823", + search="search", + ) + assert_matches_type(Optional[UserListResponse], user, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.zero_trust.dex.commands.users.with_raw_response.list( + account_id="01a7362d577a6c3019a474fd6f485823", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = response.parse() + assert_matches_type(Optional[UserListResponse], user, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.zero_trust.dex.commands.users.with_streaming_response.list( + account_id="01a7362d577a6c3019a474fd6f485823", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = response.parse() + assert_matches_type(Optional[UserListResponse], user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.dex.commands.users.with_raw_response.list( + account_id="", + ) + + +class TestAsyncUsers: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + user = await async_client.zero_trust.dex.commands.users.list( + account_id="01a7362d577a6c3019a474fd6f485823", + ) + assert_matches_type(Optional[UserListResponse], user, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + user = await async_client.zero_trust.dex.commands.users.list( + account_id="01a7362d577a6c3019a474fd6f485823", + search="search", + ) + assert_matches_type(Optional[UserListResponse], user, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.dex.commands.users.with_raw_response.list( + account_id="01a7362d577a6c3019a474fd6f485823", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = await response.parse() + assert_matches_type(Optional[UserListResponse], user, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.dex.commands.users.with_streaming_response.list( + account_id="01a7362d577a6c3019a474fd6f485823", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = await response.parse() + assert_matches_type(Optional[UserListResponse], user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.dex.commands.users.with_raw_response.list( + account_id="", + ) diff --git a/tests/api_resources/zero_trust/dlp/datasets/test_versions.py b/tests/api_resources/zero_trust/dlp/datasets/test_versions.py index 423c366940d..c37528d256f 100755 --- a/tests/api_resources/zero_trust/dlp/datasets/test_versions.py +++ b/tests/api_resources/zero_trust/dlp/datasets/test_versions.py @@ -17,6 +17,7 @@ class TestVersions: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_create(self, client: Cloudflare) -> None: version = client.zero_trust.dlp.datasets.versions.create( @@ -27,6 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: ) assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.zero_trust.dlp.datasets.versions.with_raw_response.create( @@ -41,6 +43,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: version = response.parse() assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.zero_trust.dlp.datasets.versions.with_streaming_response.create( @@ -57,6 +60,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate broken test") @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 ''"): @@ -79,6 +83,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: class TestAsyncVersions: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: version = await async_client.zero_trust.dlp.datasets.versions.create( @@ -89,6 +94,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: ) assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.dlp.datasets.versions.with_raw_response.create( @@ -103,6 +109,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: version = await response.parse() assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.dlp.datasets.versions.with_streaming_response.create( @@ -119,6 +126,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate broken test") @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 ''"): diff --git a/src/cloudflare/types/workers/ai/__init__.py b/tests/api_resources/zero_trust/dlp/email/__init__.py similarity index 70% rename from src/cloudflare/types/workers/ai/__init__.py rename to tests/api_resources/zero_trust/dlp/email/__init__.py index f8ee8b14b1c..fd8019a9a1a 100644 --- a/src/cloudflare/types/workers/ai/__init__.py +++ b/tests/api_resources/zero_trust/dlp/email/__init__.py @@ -1,3 +1 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations diff --git a/tests/api_resources/zero_trust/dlp/email/test_account_mapping.py b/tests/api_resources/zero_trust/dlp/email/test_account_mapping.py new file mode 100644 index 00000000000..8c0e9f1aaad --- /dev/null +++ b/tests/api_resources/zero_trust/dlp/email/test_account_mapping.py @@ -0,0 +1,225 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, Optional, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.types.zero_trust.dlp.email import ( + AccountMappingGetResponse, + AccountMappingCreateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAccountMapping: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + account_mapping = client.zero_trust.dlp.email.account_mapping.create( + account_id="account_id", + auth_requirements={ + "allowed_microsoft_organizations": ["string"], + "type": "Org", + }, + ) + assert_matches_type(Optional[AccountMappingCreateResponse], account_mapping, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.zero_trust.dlp.email.account_mapping.with_raw_response.create( + account_id="account_id", + auth_requirements={ + "allowed_microsoft_organizations": ["string"], + "type": "Org", + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account_mapping = response.parse() + assert_matches_type(Optional[AccountMappingCreateResponse], account_mapping, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.zero_trust.dlp.email.account_mapping.with_streaming_response.create( + account_id="account_id", + auth_requirements={ + "allowed_microsoft_organizations": ["string"], + "type": "Org", + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + account_mapping = response.parse() + assert_matches_type(Optional[AccountMappingCreateResponse], account_mapping, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.dlp.email.account_mapping.with_raw_response.create( + account_id="", + auth_requirements={ + "allowed_microsoft_organizations": ["string"], + "type": "Org", + }, + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + account_mapping = client.zero_trust.dlp.email.account_mapping.get( + account_id="account_id", + ) + assert_matches_type(Optional[AccountMappingGetResponse], account_mapping, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.zero_trust.dlp.email.account_mapping.with_raw_response.get( + account_id="account_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account_mapping = response.parse() + assert_matches_type(Optional[AccountMappingGetResponse], account_mapping, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.zero_trust.dlp.email.account_mapping.with_streaming_response.get( + account_id="account_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + account_mapping = response.parse() + assert_matches_type(Optional[AccountMappingGetResponse], account_mapping, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.dlp.email.account_mapping.with_raw_response.get( + account_id="", + ) + + +class TestAsyncAccountMapping: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + account_mapping = await async_client.zero_trust.dlp.email.account_mapping.create( + account_id="account_id", + auth_requirements={ + "allowed_microsoft_organizations": ["string"], + "type": "Org", + }, + ) + assert_matches_type(Optional[AccountMappingCreateResponse], account_mapping, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.dlp.email.account_mapping.with_raw_response.create( + account_id="account_id", + auth_requirements={ + "allowed_microsoft_organizations": ["string"], + "type": "Org", + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account_mapping = await response.parse() + assert_matches_type(Optional[AccountMappingCreateResponse], account_mapping, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.dlp.email.account_mapping.with_streaming_response.create( + account_id="account_id", + auth_requirements={ + "allowed_microsoft_organizations": ["string"], + "type": "Org", + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + account_mapping = await response.parse() + assert_matches_type(Optional[AccountMappingCreateResponse], account_mapping, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.dlp.email.account_mapping.with_raw_response.create( + account_id="", + auth_requirements={ + "allowed_microsoft_organizations": ["string"], + "type": "Org", + }, + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + account_mapping = await async_client.zero_trust.dlp.email.account_mapping.get( + account_id="account_id", + ) + assert_matches_type(Optional[AccountMappingGetResponse], account_mapping, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.dlp.email.account_mapping.with_raw_response.get( + account_id="account_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account_mapping = await response.parse() + assert_matches_type(Optional[AccountMappingGetResponse], account_mapping, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.dlp.email.account_mapping.with_streaming_response.get( + account_id="account_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + account_mapping = await response.parse() + assert_matches_type(Optional[AccountMappingGetResponse], account_mapping, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.dlp.email.account_mapping.with_raw_response.get( + account_id="", + ) diff --git a/tests/api_resources/zero_trust/dlp/email/test_rules.py b/tests/api_resources/zero_trust/dlp/email/test_rules.py new file mode 100644 index 00000000000..f64c4040aa6 --- /dev/null +++ b/tests/api_resources/zero_trust/dlp/email/test_rules.py @@ -0,0 +1,820 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, Optional, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.zero_trust.dlp.email import ( + RuleGetResponse, + RuleListResponse, + RuleCreateResponse, + RuleDeleteResponse, + RuleUpdateResponse, + RuleBulkEditResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRules: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + rule = client.zero_trust.dlp.email.rules.create( + account_id="account_id", + action={"action": "Block"}, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + ) + assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + rule = client.zero_trust.dlp.email.rules.create( + account_id="account_id", + action={ + "action": "Block", + "message": "message", + }, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + description="description", + ) + assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.zero_trust.dlp.email.rules.with_raw_response.create( + account_id="account_id", + action={"action": "Block"}, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.zero_trust.dlp.email.rules.with_streaming_response.create( + account_id="account_id", + action={"action": "Block"}, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.dlp.email.rules.with_raw_response.create( + account_id="", + action={"action": "Block"}, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + ) + + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + rule = client.zero_trust.dlp.email.rules.update( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + action={"action": "Block"}, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + ) + assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Cloudflare) -> None: + rule = client.zero_trust.dlp.email.rules.update( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + action={ + "action": "Block", + "message": "message", + }, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + description="description", + ) + assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Cloudflare) -> None: + response = client.zero_trust.dlp.email.rules.with_raw_response.update( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + action={"action": "Block"}, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with client.zero_trust.dlp.email.rules.with_streaming_response.update( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + action={"action": "Block"}, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @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.zero_trust.dlp.email.rules.with_raw_response.update( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="", + action={"action": "Block"}, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.zero_trust.dlp.email.rules.with_raw_response.update( + rule_id="", + account_id="account_id", + action={"action": "Block"}, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + ) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + rule = client.zero_trust.dlp.email.rules.list( + account_id="account_id", + ) + assert_matches_type(SyncSinglePage[RuleListResponse], rule, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.zero_trust.dlp.email.rules.with_raw_response.list( + account_id="account_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(SyncSinglePage[RuleListResponse], rule, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.zero_trust.dlp.email.rules.with_streaming_response.list( + account_id="account_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(SyncSinglePage[RuleListResponse], rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.dlp.email.rules.with_raw_response.list( + account_id="", + ) + + @parametrize + def test_method_delete(self, client: Cloudflare) -> None: + rule = client.zero_trust.dlp.email.rules.delete( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + ) + assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Cloudflare) -> None: + response = client.zero_trust.dlp.email.rules.with_raw_response.delete( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Cloudflare) -> None: + with client.zero_trust.dlp.email.rules.with_streaming_response.delete( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.dlp.email.rules.with_raw_response.delete( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.zero_trust.dlp.email.rules.with_raw_response.delete( + rule_id="", + account_id="account_id", + ) + + @parametrize + def test_method_bulk_edit(self, client: Cloudflare) -> None: + rule = client.zero_trust.dlp.email.rules.bulk_edit( + account_id="account_id", + new_priorities={"foo": 0}, + ) + assert_matches_type(Optional[RuleBulkEditResponse], rule, path=["response"]) + + @parametrize + def test_raw_response_bulk_edit(self, client: Cloudflare) -> None: + response = client.zero_trust.dlp.email.rules.with_raw_response.bulk_edit( + account_id="account_id", + new_priorities={"foo": 0}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(Optional[RuleBulkEditResponse], rule, path=["response"]) + + @parametrize + def test_streaming_response_bulk_edit(self, client: Cloudflare) -> None: + with client.zero_trust.dlp.email.rules.with_streaming_response.bulk_edit( + account_id="account_id", + new_priorities={"foo": 0}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(Optional[RuleBulkEditResponse], rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_bulk_edit(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.dlp.email.rules.with_raw_response.bulk_edit( + account_id="", + new_priorities={"foo": 0}, + ) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + rule = client.zero_trust.dlp.email.rules.get( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + ) + assert_matches_type(Optional[RuleGetResponse], rule, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.zero_trust.dlp.email.rules.with_raw_response.get( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(Optional[RuleGetResponse], rule, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.zero_trust.dlp.email.rules.with_streaming_response.get( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(Optional[RuleGetResponse], rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.dlp.email.rules.with_raw_response.get( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.zero_trust.dlp.email.rules.with_raw_response.get( + rule_id="", + account_id="account_id", + ) + + +class TestAsyncRules: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.zero_trust.dlp.email.rules.create( + account_id="account_id", + action={"action": "Block"}, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + ) + assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.zero_trust.dlp.email.rules.create( + account_id="account_id", + action={ + "action": "Block", + "message": "message", + }, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + description="description", + ) + assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.dlp.email.rules.with_raw_response.create( + account_id="account_id", + action={"action": "Block"}, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.dlp.email.rules.with_streaming_response.create( + account_id="account_id", + action={"action": "Block"}, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.dlp.email.rules.with_raw_response.create( + account_id="", + action={"action": "Block"}, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + ) + + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.zero_trust.dlp.email.rules.update( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + action={"action": "Block"}, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + ) + assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.zero_trust.dlp.email.rules.update( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + action={ + "action": "Block", + "message": "message", + }, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + description="description", + ) + assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.dlp.email.rules.with_raw_response.update( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + action={"action": "Block"}, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.dlp.email.rules.with_streaming_response.update( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + action={"action": "Block"}, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @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.zero_trust.dlp.email.rules.with_raw_response.update( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="", + action={"action": "Block"}, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + await async_client.zero_trust.dlp.email.rules.with_raw_response.update( + rule_id="", + account_id="account_id", + action={"action": "Block"}, + conditions=[ + { + "operator": "InList", + "selector": "Recipients", + "value": {}, + } + ], + enabled=True, + name="name", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.zero_trust.dlp.email.rules.list( + account_id="account_id", + ) + assert_matches_type(AsyncSinglePage[RuleListResponse], rule, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.dlp.email.rules.with_raw_response.list( + account_id="account_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(AsyncSinglePage[RuleListResponse], rule, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.dlp.email.rules.with_streaming_response.list( + account_id="account_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(AsyncSinglePage[RuleListResponse], rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.dlp.email.rules.with_raw_response.list( + account_id="", + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.zero_trust.dlp.email.rules.delete( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + ) + assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.dlp.email.rules.with_raw_response.delete( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.dlp.email.rules.with_streaming_response.delete( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.dlp.email.rules.with_raw_response.delete( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + await async_client.zero_trust.dlp.email.rules.with_raw_response.delete( + rule_id="", + account_id="account_id", + ) + + @parametrize + async def test_method_bulk_edit(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.zero_trust.dlp.email.rules.bulk_edit( + account_id="account_id", + new_priorities={"foo": 0}, + ) + assert_matches_type(Optional[RuleBulkEditResponse], rule, path=["response"]) + + @parametrize + async def test_raw_response_bulk_edit(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.dlp.email.rules.with_raw_response.bulk_edit( + account_id="account_id", + new_priorities={"foo": 0}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(Optional[RuleBulkEditResponse], rule, path=["response"]) + + @parametrize + async def test_streaming_response_bulk_edit(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.dlp.email.rules.with_streaming_response.bulk_edit( + account_id="account_id", + new_priorities={"foo": 0}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(Optional[RuleBulkEditResponse], rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_bulk_edit(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.dlp.email.rules.with_raw_response.bulk_edit( + account_id="", + new_priorities={"foo": 0}, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.zero_trust.dlp.email.rules.get( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + ) + assert_matches_type(Optional[RuleGetResponse], rule, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.dlp.email.rules.with_raw_response.get( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(Optional[RuleGetResponse], rule, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.dlp.email.rules.with_streaming_response.get( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="account_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(Optional[RuleGetResponse], rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.dlp.email.rules.with_raw_response.get( + rule_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + await async_client.zero_trust.dlp.email.rules.with_raw_response.get( + rule_id="", + account_id="account_id", + ) diff --git a/tests/api_resources/zero_trust/dlp/test_entries.py b/tests/api_resources/zero_trust/dlp/test_entries.py index cf41c61b9f9..d0a651e7f92 100644 --- a/tests/api_resources/zero_trust/dlp/test_entries.py +++ b/tests/api_resources/zero_trust/dlp/test_entries.py @@ -91,6 +91,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_update_overload_1(self, client: Cloudflare) -> None: entry = client.zero_trust.dlp.entries.update( @@ -102,6 +103,7 @@ def test_method_update_overload_1(self, client: Cloudflare) -> None: ) assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> None: entry = client.zero_trust.dlp.entries.update( @@ -117,6 +119,7 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N ) assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_raw_response_update_overload_1(self, client: Cloudflare) -> None: response = client.zero_trust.dlp.entries.with_raw_response.update( @@ -132,6 +135,7 @@ def test_raw_response_update_overload_1(self, client: Cloudflare) -> None: entry = response.parse() assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: with client.zero_trust.dlp.entries.with_streaming_response.update( @@ -149,6 +153,7 @@ def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update_overload_1(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): @@ -169,6 +174,7 @@ def test_path_params_update_overload_1(self, client: Cloudflare) -> None: type="custom", ) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_update_overload_2(self, client: Cloudflare) -> None: entry = client.zero_trust.dlp.entries.update( @@ -178,6 +184,7 @@ def test_method_update_overload_2(self, client: Cloudflare) -> None: ) assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> None: entry = client.zero_trust.dlp.entries.update( @@ -188,6 +195,7 @@ def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> N ) assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_raw_response_update_overload_2(self, client: Cloudflare) -> None: response = client.zero_trust.dlp.entries.with_raw_response.update( @@ -201,6 +209,7 @@ def test_raw_response_update_overload_2(self, client: Cloudflare) -> None: entry = response.parse() assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_streaming_response_update_overload_2(self, client: Cloudflare) -> None: with client.zero_trust.dlp.entries.with_streaming_response.update( @@ -216,6 +225,7 @@ def test_streaming_response_update_overload_2(self, client: Cloudflare) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update_overload_2(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): @@ -232,6 +242,7 @@ def test_path_params_update_overload_2(self, client: Cloudflare) -> None: type="predefined", ) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_update_overload_3(self, client: Cloudflare) -> None: entry = client.zero_trust.dlp.entries.update( @@ -241,6 +252,7 @@ def test_method_update_overload_3(self, client: Cloudflare) -> None: ) assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_update_with_all_params_overload_3(self, client: Cloudflare) -> None: entry = client.zero_trust.dlp.entries.update( @@ -251,6 +263,7 @@ def test_method_update_with_all_params_overload_3(self, client: Cloudflare) -> N ) assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_raw_response_update_overload_3(self, client: Cloudflare) -> None: response = client.zero_trust.dlp.entries.with_raw_response.update( @@ -264,6 +277,7 @@ def test_raw_response_update_overload_3(self, client: Cloudflare) -> None: entry = response.parse() assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_streaming_response_update_overload_3(self, client: Cloudflare) -> None: with client.zero_trust.dlp.entries.with_streaming_response.update( @@ -279,6 +293,7 @@ def test_streaming_response_update_overload_3(self, client: Cloudflare) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update_overload_3(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): @@ -501,6 +516,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> None: entry = await async_client.zero_trust.dlp.entries.update( @@ -512,6 +528,7 @@ async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> ) assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_update_with_all_params_overload_1(self, async_client: AsyncCloudflare) -> None: entry = await async_client.zero_trust.dlp.entries.update( @@ -527,6 +544,7 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn ) assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_raw_response_update_overload_1(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.dlp.entries.with_raw_response.update( @@ -542,6 +560,7 @@ async def test_raw_response_update_overload_1(self, async_client: AsyncCloudflar entry = await response.parse() assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_streaming_response_update_overload_1(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.dlp.entries.with_streaming_response.update( @@ -559,6 +578,7 @@ async def test_streaming_response_update_overload_1(self, async_client: AsyncClo assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update_overload_1(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): @@ -579,6 +599,7 @@ async def test_path_params_update_overload_1(self, async_client: AsyncCloudflare type="custom", ) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> None: entry = await async_client.zero_trust.dlp.entries.update( @@ -588,6 +609,7 @@ async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> ) assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_update_with_all_params_overload_2(self, async_client: AsyncCloudflare) -> None: entry = await async_client.zero_trust.dlp.entries.update( @@ -598,6 +620,7 @@ async def test_method_update_with_all_params_overload_2(self, async_client: Asyn ) assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_raw_response_update_overload_2(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.dlp.entries.with_raw_response.update( @@ -611,6 +634,7 @@ async def test_raw_response_update_overload_2(self, async_client: AsyncCloudflar entry = await response.parse() assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_streaming_response_update_overload_2(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.dlp.entries.with_streaming_response.update( @@ -626,6 +650,7 @@ async def test_streaming_response_update_overload_2(self, async_client: AsyncClo assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update_overload_2(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): @@ -642,6 +667,7 @@ async def test_path_params_update_overload_2(self, async_client: AsyncCloudflare type="predefined", ) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_update_overload_3(self, async_client: AsyncCloudflare) -> None: entry = await async_client.zero_trust.dlp.entries.update( @@ -651,6 +677,7 @@ async def test_method_update_overload_3(self, async_client: AsyncCloudflare) -> ) assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_update_with_all_params_overload_3(self, async_client: AsyncCloudflare) -> None: entry = await async_client.zero_trust.dlp.entries.update( @@ -661,6 +688,7 @@ async def test_method_update_with_all_params_overload_3(self, async_client: Asyn ) assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_raw_response_update_overload_3(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.dlp.entries.with_raw_response.update( @@ -674,6 +702,7 @@ async def test_raw_response_update_overload_3(self, async_client: AsyncCloudflar entry = await response.parse() assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_streaming_response_update_overload_3(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.dlp.entries.with_streaming_response.update( @@ -689,6 +718,7 @@ async def test_streaming_response_update_overload_3(self, async_client: AsyncClo assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update_overload_3(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): diff --git a/tests/api_resources/zero_trust/gateway/test_lists.py b/tests/api_resources/zero_trust/gateway/test_lists.py index 5448c53e5b9..4c81584d3e3 100644 --- a/tests/api_resources/zero_trust/gateway/test_lists.py +++ b/tests/api_resources/zero_trust/gateway/test_lists.py @@ -99,6 +99,12 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", name="Admin Serial Numbers", description="The serial numbers for administrators", + items=[ + { + "description": "Austin office IP", + "value": "8GE8721REF", + } + ], ) assert_matches_type(Optional[GatewayList], list_, path=["response"]) @@ -433,6 +439,12 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare account_id="699d98642c564d2e855e9661899b7252", name="Admin Serial Numbers", description="The serial numbers for administrators", + items=[ + { + "description": "Austin office IP", + "value": "8GE8721REF", + } + ], ) assert_matches_type(Optional[GatewayList], list_, path=["response"]) diff --git a/tests/api_resources/zero_trust/gateway/test_rules.py b/tests/api_resources/zero_trust/gateway/test_rules.py index 8852212a8b5..e1ed5506b92 100644 --- a/tests/api_resources/zero_trust/gateway/test_rules.py +++ b/tests/api_resources/zero_trust/gateway/test_rules.py @@ -105,6 +105,10 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: "override_ips": ["1.1.1.1", "2.2.2.2"], "payload_log": {"enabled": True}, "quarantine": {"file_types": ["exe"]}, + "resolve_dns_internally": { + "fallback": "none", + "view_id": "view_id", + }, "resolve_dns_through_cloudflare": True, "untrusted_cert": {"action": "pass_through"}, }, @@ -245,6 +249,10 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "override_ips": ["1.1.1.1", "2.2.2.2"], "payload_log": {"enabled": True}, "quarantine": {"file_types": ["exe"]}, + "resolve_dns_internally": { + "fallback": "none", + "view_id": "view_id", + }, "resolve_dns_through_cloudflare": True, "untrusted_cert": {"action": "pass_through"}, }, @@ -580,6 +588,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare "override_ips": ["1.1.1.1", "2.2.2.2"], "payload_log": {"enabled": True}, "quarantine": {"file_types": ["exe"]}, + "resolve_dns_internally": { + "fallback": "none", + "view_id": "view_id", + }, "resolve_dns_through_cloudflare": True, "untrusted_cert": {"action": "pass_through"}, }, @@ -720,6 +732,10 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "override_ips": ["1.1.1.1", "2.2.2.2"], "payload_log": {"enabled": True}, "quarantine": {"file_types": ["exe"]}, + "resolve_dns_internally": { + "fallback": "none", + "view_id": "view_id", + }, "resolve_dns_through_cloudflare": True, "untrusted_cert": {"action": "pass_through"}, }, diff --git a/tests/api_resources/zero_trust/organizations/test_doh.py b/tests/api_resources/zero_trust/organizations/test_doh.py index 3b0c04a90dc..58ac94ae30a 100644 --- a/tests/api_resources/zero_trust/organizations/test_doh.py +++ b/tests/api_resources/zero_trust/organizations/test_doh.py @@ -28,7 +28,7 @@ def test_method_update(self, client: Cloudflare) -> None: def test_method_update_with_all_params(self, client: Cloudflare) -> None: doh = client.zero_trust.organizations.doh.update( account_id="023e105f4ecef8ad9ca31a8372d0c353", - jwt_duration="800h", + doh_jwt_duration="800h", service_token_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) assert_matches_type(Optional[DOHUpdateResponse], doh, path=["response"]) @@ -117,7 +117,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: doh = await async_client.zero_trust.organizations.doh.update( account_id="023e105f4ecef8ad9ca31a8372d0c353", - jwt_duration="800h", + doh_jwt_duration="800h", service_token_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) assert_matches_type(Optional[DOHUpdateResponse], doh, path=["response"]) diff --git a/tests/api_resources/zero_trust/test_devices.py b/tests/api_resources/zero_trust/test_devices.py index f814c7c80bc..e806fd8d30e 100644 --- a/tests/api_resources/zero_trust/test_devices.py +++ b/tests/api_resources/zero_trust/test_devices.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -62,7 +62,7 @@ def test_method_get(self, client: Cloudflare) -> None: device_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(DeviceGetResponse, device, path=["response"]) + assert_matches_type(Optional[DeviceGetResponse], device, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -74,7 +74,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" device = response.parse() - assert_matches_type(DeviceGetResponse, device, path=["response"]) + assert_matches_type(Optional[DeviceGetResponse], device, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -86,7 +86,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" device = response.parse() - assert_matches_type(DeviceGetResponse, device, path=["response"]) + assert_matches_type(Optional[DeviceGetResponse], device, path=["response"]) assert cast(Any, response.is_closed) is True @@ -152,7 +152,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: device_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(DeviceGetResponse, device, path=["response"]) + assert_matches_type(Optional[DeviceGetResponse], device, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -164,7 +164,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" device = await response.parse() - assert_matches_type(DeviceGetResponse, device, path=["response"]) + assert_matches_type(Optional[DeviceGetResponse], device, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -176,7 +176,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" device = await response.parse() - assert_matches_type(DeviceGetResponse, device, path=["response"]) + assert_matches_type(Optional[DeviceGetResponse], device, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/test_holds.py b/tests/api_resources/zones/test_holds.py index c49066aee53..b34e5066342 100644 --- a/tests/api_resources/zones/test_holds.py +++ b/tests/api_resources/zones/test_holds.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest @@ -68,7 +68,7 @@ def test_method_delete(self, client: Cloudflare) -> None: hold = client.zones.holds.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneHold], hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) @parametrize def test_method_delete_with_all_params(self, client: Cloudflare) -> None: @@ -76,7 +76,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", hold_after="hold_after", ) - assert_matches_type(Optional[ZoneHold], hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -87,7 +87,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" hold = response.parse() - assert_matches_type(Optional[ZoneHold], hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -98,7 +98,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" hold = response.parse() - assert_matches_type(Optional[ZoneHold], hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) assert cast(Any, response.is_closed) is True @@ -109,6 +109,53 @@ def test_path_params_delete(self, client: Cloudflare) -> None: zone_id="", ) + @parametrize + def test_method_edit(self, client: Cloudflare) -> None: + hold = client.zones.holds.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(ZoneHold, hold, path=["response"]) + + @parametrize + def test_method_edit_with_all_params(self, client: Cloudflare) -> None: + hold = client.zones.holds.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + hold_after="2023-01-31T15:56:36+00:00", + include_subdomains=True, + ) + assert_matches_type(ZoneHold, hold, path=["response"]) + + @parametrize + def test_raw_response_edit(self, client: Cloudflare) -> None: + response = client.zones.holds.with_raw_response.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + hold = response.parse() + assert_matches_type(ZoneHold, hold, path=["response"]) + + @parametrize + def test_streaming_response_edit(self, client: Cloudflare) -> None: + with client.zones.holds.with_streaming_response.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + hold = response.parse() + assert_matches_type(ZoneHold, hold, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_edit(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.zones.holds.with_raw_response.edit( + zone_id="", + ) + @parametrize def test_method_get(self, client: Cloudflare) -> None: hold = client.zones.holds.get( @@ -202,7 +249,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: hold = await async_client.zones.holds.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneHold], hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -210,7 +257,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare zone_id="023e105f4ecef8ad9ca31a8372d0c353", hold_after="hold_after", ) - assert_matches_type(Optional[ZoneHold], hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -221,7 +268,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" hold = await response.parse() - assert_matches_type(Optional[ZoneHold], hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -232,7 +279,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" hold = await response.parse() - assert_matches_type(Optional[ZoneHold], hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) assert cast(Any, response.is_closed) is True @@ -243,6 +290,53 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: zone_id="", ) + @parametrize + async def test_method_edit(self, async_client: AsyncCloudflare) -> None: + hold = await async_client.zones.holds.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(ZoneHold, hold, path=["response"]) + + @parametrize + async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: + hold = await async_client.zones.holds.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + hold_after="2023-01-31T15:56:36+00:00", + include_subdomains=True, + ) + assert_matches_type(ZoneHold, hold, path=["response"]) + + @parametrize + async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zones.holds.with_raw_response.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + hold = await response.parse() + assert_matches_type(ZoneHold, hold, path=["response"]) + + @parametrize + async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: + async with async_client.zones.holds.with_streaming_response.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + hold = await response.parse() + assert_matches_type(ZoneHold, hold, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.zones.holds.with_raw_response.edit( + zone_id="", + ) + @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: hold = await async_client.zones.holds.get(